📄 expressionexpand.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using Smark.Data.Mappings;
namespace Smark.Data
{
public partial class Expression
{
public IList<T> List<T>() where T : Mappings.DataObject, new()
{
return List<T>((Region)null);
}
public IList<T> List<T>(Region region) where T : Mappings.DataObject, new()
{
return List<T>(region, null);
}
public IList<T> List<T>(Region region,string orderby) where T : Mappings.DataObject,new()
{
ObjectMapper om = ObjectMapper.GetOM(typeof(T));
using (IConnectinContext cc = om.Connection.GetContext())
{
return List<T>(cc, region, orderby);
}
}
public IList<T> List<T>(IConnectinContext cc) where T : Mappings.DataObject, new()
{
return List<T>(cc, null, null);
}
public IList<T> List<T>(IConnectinContext cc,Region region) where T : Mappings.DataObject, new()
{
return List<T>(cc, region, null);
}
public IList<T> List<T>(IConnectinContext cc, Region region, string orderby) where T : Mappings.DataObject,new()
{
ObjectMapper om = ObjectMapper.GetOM(typeof(T));
return EntityBase.ExOnList<T>(cc, om.Select, this, region, orderby, om.GroupBy);
}
public T ListFirst<T>() where T : Mappings.DataObject, new()
{
return ListFirst<T>((string)null);
}
public T ListFirst<T>(IConnectinContext cc) where T : Mappings.DataObject, new()
{
return ListFirst<T>(cc, null);
}
public T ListFirst<T>(string orderby) where T : Mappings.DataObject, new()
{
ObjectMapper om = ObjectMapper.GetOM(typeof(T));
using (IConnectinContext cc = om.Connection.GetContext())
{
return ListFirst<T>(cc, orderby);
}
}
public T ListFirst<T>(IConnectinContext cc, string orderby) where T:Mappings.DataObject,new()
{
ObjectMapper om = ObjectMapper.GetOM(typeof(T));
return EntityBase.ExOnListFirst<T>(cc, om.Select, this, orderby, om.GroupBy);
}
public void Delete<T>()
{
ObjectMapper om = ObjectMapper.GetOM(typeof(T));
using (IConnectinContext cc = om.Connection.GetContext())
{
Delete<T>(cc);
}
}
public void Delete<T>(IConnectinContext cc)
{
ObjectMapper om = ObjectMapper.GetOM(typeof(T));
EntityBase.ExOnDelete(cc, om.Table, this);
}
public void Edit<T>(params Field[] fields)
{
ObjectMapper om = ObjectMapper.GetOM(typeof(T));
using (IConnectinContext cc = om.Connection.GetContext())
{
Edit<T>(cc);
}
}
public void Edit<T>(IConnectinContext cc, params Field[] fields)
{
if (fields == null || fields.Length == 0)
return;
ObjectMapper om = ObjectMapper.GetOM(typeof(T));
Update update = new Update(om.Table);
update.Where = this;
foreach (Field f in fields)
{
update.AddField(f.Name, f.Value);
}
update.Execute(cc);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -