public void SubmitForm(ItemMasterEntity itemMaster, List <ItemMasterPicEntity> itemMasterPic, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { //db.Update(itemMaster); } else { using (NFineDbContext db = new NFineDbContext()) { using (TransactionScope trans = new TransactionScope()) { db.Entry <ItemMasterEntity>(itemMaster).State = EntityState.Added; db.SaveChanges(); foreach (ItemMasterPicEntity item in itemMasterPic) { item.F_ItemMaster = itemMaster.F_Id; db.Entry <ItemMasterPicEntity>(item).State = EntityState.Added; } db.SaveChanges(); trans.Complete(); } } } }
private void PreApplicationStartMethod() { using (var dbcontext = new NFineDbContext()) { var objectContext = ((IObjectContextAdapter)dbcontext).ObjectContext; var mappingCollection = (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace); mappingCollection.GenerateViews(new List <EdmSchemaError>()); } }
/// <summary> /// 启动应用程序 /// </summary> protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); using (var dbcontext = new NFineDbContext()) { var objectContext = ((IObjectContextAdapter)dbcontext).ObjectContext; var mappingCollection = (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace); mappingCollection.GenerateViews(new List <EdmSchemaError>()); } }
public ModuleButtonRepository(NFineDbContext dbContext, IRepositoryBase repositoryBase) : base(dbContext) { this.repositoryBase = repositoryBase; }
public ItemsDetailRepository(NFineDbContext dbContext) : base(dbContext) { }
public UserRepository(NFineDbContext dbContext, IRepositoryBase repositoryBase) : base(dbContext) { this.repositoryBase = repositoryBase; }
public FilterIPRepository(NFineDbContext dbContext) : base(dbContext) { }
public OrganizeRepository(NFineDbContext dbContext) : base(dbContext) { }
public ModuleRepository(NFineDbContext dbContext) : base(dbContext) { }
public UserLogOnRepository(NFineDbContext dbContext) : base(dbContext) { }
public RoleAuthorizeRepository(NFineDbContext dbContext) : base(dbContext) { }
public AreaRepository(NFineDbContext dbContext) : base(dbContext) { }
public NewsInfoRepository(NFineDbContext dbContext) : base(dbContext) { }
public LogRepository(NFineDbContext dbContext) : base(dbContext) { }