public MainWindow() { InitializeComponent(); EntityContextBuilder builder = new EntityContextBuilder(new DataContext()); _Controller = new EntityController(builder); }
/// <summary> /// 获取实体上下文 /// </summary> /// <param name="context">构建上下文</param> public static EntityContext GetEntityContext(this BuildContext context) { if (!context.Items.ContainsKey(EntityContext)) { var entityContextBuilder = new EntityContextBuilder(); var entityContext = entityContextBuilder.Build(context); context.SetItem(EntityContext, entityContext); return(entityContext); } return(context.GetItem <EntityContext>(EntityContext)); }