public Type GetEntityType(EntityDbContext dc) { var entityName = dc.Table <Bundle>().Find(Id).EntityName; var entityType = TypeHelper.GetClassesWithInterface <IBundlableEntity>(EntityDbContext.Assembles).FirstOrDefault(x => x.Name == entityName); return(entityType); }
public static bool Add(this View viewModel, EntityDbContext dc) { if (viewModel.IsExist <View>(dc)) { return(false); } dc.Table <View>().Add(viewModel); return(true); }
public IQueryable <BundleDbRecord> QueryRecords(EntityDbContext dc) { var type = TypeHelper.GetClassesWithInterface <IBundlableEntity>(EntityDbContext.Assembles).FirstOrDefault(x => x.Name == EntityName); if (type == null) { throw new Exception($"Can't find entity: {EntityName}"); } return(dc.Table(EntityName).Where(x => (x as BundleDbRecord).BundleId == Id).Select(x => x.ToObject(type) as BundleDbRecord)); }
public virtual bool InsertEntity(EntityDbContext dc, String entityName) { if (dc.Table(entityName).Any(x => (x as Entity).Id == Id)) { return(false); } dc.Add(this); LoadFieldsDefinition(dc); var types = TypeHelper.GetClassesWithInterface <IFieldRepository>(EntityDbContext.Assembles) .Where(x => x.Name.StartsWith(entityName) && x.Name.EndsWith("Field")).ToList(); types.ForEach(fieldType => { AddFieldRecords(dc, fieldType); }); return(true); }
public override bool IsExist <T>(EntityDbContext dc) { return(dc.Table <ViewAction>().Any(x => x.ViewId == ViewId && x.Name == Name)); }
public override bool IsExist <T>(EntityDbContext dc) { return(dc.Table <FieldInBundle>().Any(x => x.BundleId == BundleId && x.Name == Name)); }
public virtual bool IsExist <T>(EntityDbContext dc) where T : Entity { return(dc.Table <T>().Any(x => x.Id == Id)); }
public override bool IsExist <T>(EntityDbContext dc) { return(dc.Table <ViewColum>().Any(x => x.ViewId == ViewId && x.FieldName == FieldName)); }
public override bool IsExist <T>(EntityDbContext dc) { return(dc.Table <Bundle>().Any(x => x.EntityName == EntityName && x.Name == Name)); }
public List <Object> Load(EntityDbContext dc, String entityName, String fieldTypeName) { var fields = dc.Table($"{entityName}{fieldTypeName}Field").Where(x => (x as FieldRepository).EntityId == EntityId && (x as FieldRepository).BundleFieldId == BundleFieldId).ToList(); return(fields.Select(x => x).ToList()); }