我有实体项目的 Silverlight 项目,这是我的表类
public class OrderHeader : INotifyPropertyChanged
{
public string OrderId{get;set;}
}
我有
public class DataBaseContext : DbContext
{
public DbSet<OrderHeader> OrderHeaders { get; set; }
}
我有域名服务
[EnableClientAccess()]
public class ShopService : DomainService
{
[Invoke]
public OrderHeader GetOrderHeader()
{
using (var db = new DataBaseContext())
{
return db.OrderHeader.FirstOrdefault(o=>o.OrderId == "123";
}
}
}
在我的 SL 应用程序中,我想使用 OrderHeader 作为部分类。就像是
public partial class OrderHeader
{
public DateTime LoadDate{get;set;}
}
private void LoadData()
{
ShopServiceContext context = new ShopServiceContext();
context.GetOrderHeader(OrderLoaded, null)
}
private void OrderLoaded(InvokeOperation<OrderHeader> result)
{
var loadedOrder = result.Value; //load order this is my partial class from SL app
loadedOrder.Loaddate = DateTime.Now;
}
我可以像这样创造一些想法吗?