Esempio n. 1
0
        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);
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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));
 }
Esempio n. 6
0
 public override bool IsExist <T>(EntityDbContext dc)
 {
     return(dc.Table <FieldInBundle>().Any(x => x.BundleId == BundleId && x.Name == Name));
 }
Esempio n. 7
0
 public virtual bool IsExist <T>(EntityDbContext dc) where T : Entity
 {
     return(dc.Table <T>().Any(x => x.Id == Id));
 }
Esempio n. 8
0
 public override bool IsExist <T>(EntityDbContext dc)
 {
     return(dc.Table <ViewColum>().Any(x => x.ViewId == ViewId && x.FieldName == FieldName));
 }
Esempio n. 9
0
 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());
        }