//private void RefreshMetaSetCache() //{ // // 生成缓存 // foreach (var et in new Type[] { // typeof(Customer), typeof(Contact), typeof(Opportunity), typeof(Activity), typeof(Product) // }) // { // MetaSet.Load(et); // } //} public void Dispose() { if (_contextImpl != null) { _contextImpl.Dispose(); _contextImpl = null; } }
private static void Setup(string[] args) { Database.DefaultConnectionFactory = new SqlConnectionFactory("System.Data.SqlClient"); using (var context = new CodeFirstIOCDemoContextImpl()) { #if !DEBUG try { #endif new DropCreateDatabaseAlways<CodeFirstIOCDemoContextImpl>().InitializeDatabase(context); #if !DEBUG } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e); } #endif } }
internal CodeFirstIOCDemoContext(CodeFirstIOCDemoContextImpl impl) { _contextImpl = impl; _tableMap = new Hashtable(); Comments = RegisterTable <Comment>("Comments"); Roles = RegisterTable <Role>("Roles"); Employees = RegisterTable <Employee>("Employees"); Permissions = RegisterTable <Permission>("Permissions"); Organizations = RegisterTable <Organization>("Organizations"); Settings = RegisterTable <Setting>("Settings"); MilestoneTemplates = RegisterTable <MilestoneTemplate>("MilestoneTemplates"); MilestoneTemplateItems = RegisterTable <MilestoneTemplateItem>("MilestoneTemplateItems"); RoleTemplates = RegisterTable <RoleTemplate>("RoleTemplates"); TaskTemplates = RegisterTable <TaskTemplate>("TaskTemplates"); Milestones = RegisterTable <Milestone>("Milestones"); Projects = RegisterTable <Project>("Projects"); TaskTemplateItems = RegisterTable <TaskTemplateItem>("TaskTemplateItems"); ProjectTasks = RegisterTable <ProjectTask>("ProjectTasks"); TaskOutputs = RegisterTable <TaskOutput>("TaskOutputs"); RoleTemplateItems = RegisterTable <RoleTemplateItem>("RoleTemplateItems"); }