コード例 #1
0
        private string GetValueToUpdate(Field field)
        {
            if(!field.IsEntity)
                return new ValueFieldFormatted(objectInsert, field).Format();

            return GetJoinIdValue(field);
        }
コード例 #2
0
        public static FieldAliasReplacer Get(Field field)
        {
            if (IsBoolField(field))
                return new BoolFieldAliasReplacer();

            return new FieldAliasReplacer();
        }
コード例 #3
0
 private void LoadFieldsByFieldsInfo(Dictionary<string, Field> fields)
 {
     foreach (FieldInfo fieldInfo in type.GetFields())
     {
         Field field = new Field(fieldInfo);
         fields.Add(field.ColumnName, field);
         VerifyIsEntity(field);
     }
 }
コード例 #4
0
        private string GetJoinIdValue(Field field)
        {
            object join = new ValueFieldExtractor(objectInsert, field).Extract();

            Entity entityJoin = DictionaryEntitiesMap.INSTANCE.GetEntity(join.GetType());
            Field idField = entityJoin.FieldDictionary["id"];

            return new ValueFieldFormatted(join, idField).Format();
        }
コード例 #5
0
        private EntityJoin Generate(Entity entity, Field field)
        {
            Alias alias = CreateAlias(entity, field);
            EntityJoin join = new EntityJoin(alias);

            entity.GetFields().Where(f => f.IsEntity).ToList()
                .ForEach(f => join.Joins.Add(Generate(f)));

            return join;
        }
コード例 #6
0
        private void ReplaceConditionField(EntityJoin join, Field field, string entityPath)
        {
            FieldAliasReplacer replacer = new FieldAliasReplacerBuilder()
                .Entity(join)
                .Field(field)
                .SqlQuery(sqlCommand)
                .EntityPath(entityPath)
                .Builder();

            sqlCommand = replacer.Replace();
        }
コード例 #7
0
        private string GetJoinIdValue(Field field)
        {
            var join = GetObjectField(objectUpdate, field);

            if (join == null)
                return "null";

            Entity entityJoin = DictionaryEntitiesMap.INSTANCE.GetEntity(join.GetType());
            Field idField = entityJoin.FieldDictionary["id"];

            return new ValueFieldFormatted(join, idField).Format();
        }
コード例 #8
0
 private void LoadFieldsByMethods(Dictionary<string, Field> fields)
 {
     foreach (MethodInfo method in type.GetMethods())
     {
         if (isPropertyMethod(method))
         {
             Field field = new Field(method);
             fields.Add(field.ColumnName, field);
             VerifyIsEntity(field);
         }
     }
 }
コード例 #9
0
        private void ProcessJoin(Field field)
        {
            var objectJoin = new ValueFieldExtractor(objectCommand, field).Extract();

            if (objectJoin == null)
                return;

            new NonQueryCommandsExecutor(objectJoin).Execute();
        }
コード例 #10
0
 private static bool IsBoolField(Field field)
 {
     return field.Type == typeof(bool);
 }
コード例 #11
0
ファイル: EntityLoader.cs プロジェクト: EntityJoke/entityjoke
 private bool IsBool(Field field)
 {
     return typeof(bool) == field.Type;
 }
コード例 #12
0
ファイル: EntityLoader.cs プロジェクト: EntityJoke/entityjoke
 private void SetFieldValue(Field field, object value)
 {
     if(IsBool(field))
         new FieldBoolValueSetter(obj, field, value).Set();
     else
         new FieldValueSetter(obj, field, value).Set();
 }
コード例 #13
0
 private object GetValue(object origin, Field field)
 {
     return new ValueFieldExtractor(origin, field).Extract();
 }
コード例 #14
0
ファイル: EntityLoader.cs プロジェクト: Hyrwing/entityjoke
 private void SetFieldValue(Field field, object value)
 {
     new FieldValueSetter(obj, field, value).Set();
 }
コード例 #15
0
        private bool IsEqualsField(object obj, Field field)
        {
            var aspect = DictionaryEntitiesAspects.GetInstance().GetAspect(obj);

            if (aspect == null)
                return obj == null;

            var valueA = new ValueFieldExtractor(obj, field).Extract();
            var valueB = new ValueFieldExtractor(aspect, field).Extract();

            return IsEqualsObjects(valueA, valueB);
        }
コード例 #16
0
 private Alias CreateAlias(Entity entity, Field field)
 {
     Alias alias = new Alias(entity, CreateSymbol(entity));
     dictionaryAliases.Add(alias.Symbol, alias);
     return alias;
 }
コード例 #17
0
 private string GetValueToDelete(Field field)
 {
     return new ValueFieldFormatted(objectDelete, field).Format();
 }
コード例 #18
0
 public FieldBoolValueSetter(object obj, Field field, object value)
     : base(obj, field, value)
 {
     this.value = BoolValue(value);
 }
コード例 #19
0
 public FieldAliasReplacerBuilder Field(Field field)
 {
     this.field = field;
     return this;
 }
コード例 #20
0
 private void ProcessJoins(object obj, Field f)
 {
     var objJoin = new ValueFieldExtractor(obj, f).Extract();
     DictionaryEntitiesAspects.GetInstance().AddOrRefreshAspect(objJoin);
 }
コード例 #21
0
 private bool HasChange(Field field)
 {
     return field.IsEntity ? !IsEqualsJoinObjects(objectUpdate, field) : !IsEqualsField(objectUpdate, field);
 }
コード例 #22
0
 public FieldValueSetter(object obj, Field field, object value)
 {
     this.obj = obj;
     this.field = field;
     this.value = value;
 }
コード例 #23
0
        private bool IsEqualsJoinObjects(object obj, Field field)
        {
            var aspect = DictionaryEntitiesAspects.GetInstance().GetAspect(objectUpdate);
            var valueA = GetObjectField(aspect, field);

            var valueB = GetObjectField(obj, field);

            if (valueA == null)
                return valueB == null;

            if (valueB == null)
                return false;

            Entity entityJoin = DictionaryEntitiesMap.INSTANCE.GetEntity(valueB.GetType());
            Field fieldId = entityJoin.FieldDictionary["id"];

            return IsEqualsField(valueB, fieldId);
        }
コード例 #24
0
 private static void VerifyIsEntity(Field field)
 {
     if (field.IsEntity)
         DictionaryEntitiesMap.INSTANCE.TryAddEntity(field.Type);
 }
コード例 #25
0
 private object GetObjectField(object obj, Field field)
 {
     return new ValueFieldExtractor(obj, field).Extract();
 }
コード例 #26
0
 private EntityJoin Generate(Field field)
 {
     EntityJoin join = Generate(GetEntity(field.Type), field);
     join.Field = field;
     return join;
 }
コード例 #27
0
 public ValueFieldExtractor(object objectValue, Field idField)
 {
     this.objectValue = objectValue;
     this.field = idField;
 }
コード例 #28
0
ファイル: EntityLoader.cs プロジェクト: EntityJoke/entityjoke
 private void RefreshFieldValue(object objectDictionary, Field field)
 {
     new FieldValueSetter(objectDictionary, field, GetValue(field)).Set();
 }
コード例 #29
0
 public ValueFieldFormatted(object objectValue, Field field)
 {
     this.objectValue = objectValue;
     this.field = field;
 }
コード例 #30
0
 private void CopyFieldValue(object origin, object copy, Field field)
 {
     new FieldValueSetter(copy, field, GetValue(origin, field)).Set();
 }