private string GetValueToUpdate(Field field) { if(!field.IsEntity) return new ValueFieldFormatted(objectInsert, field).Format(); return GetJoinIdValue(field); }
public static FieldAliasReplacer Get(Field field) { if (IsBoolField(field)) return new BoolFieldAliasReplacer(); return new FieldAliasReplacer(); }
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); } }
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(); }
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; }
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(); }
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(); }
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); } } }
private void ProcessJoin(Field field) { var objectJoin = new ValueFieldExtractor(objectCommand, field).Extract(); if (objectJoin == null) return; new NonQueryCommandsExecutor(objectJoin).Execute(); }
private static bool IsBoolField(Field field) { return field.Type == typeof(bool); }
private bool IsBool(Field field) { return typeof(bool) == field.Type; }
private void SetFieldValue(Field field, object value) { if(IsBool(field)) new FieldBoolValueSetter(obj, field, value).Set(); else new FieldValueSetter(obj, field, value).Set(); }
private object GetValue(object origin, Field field) { return new ValueFieldExtractor(origin, field).Extract(); }
private void SetFieldValue(Field field, object value) { new FieldValueSetter(obj, field, value).Set(); }
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); }
private Alias CreateAlias(Entity entity, Field field) { Alias alias = new Alias(entity, CreateSymbol(entity)); dictionaryAliases.Add(alias.Symbol, alias); return alias; }
private string GetValueToDelete(Field field) { return new ValueFieldFormatted(objectDelete, field).Format(); }
public FieldBoolValueSetter(object obj, Field field, object value) : base(obj, field, value) { this.value = BoolValue(value); }
public FieldAliasReplacerBuilder Field(Field field) { this.field = field; return this; }
private void ProcessJoins(object obj, Field f) { var objJoin = new ValueFieldExtractor(obj, f).Extract(); DictionaryEntitiesAspects.GetInstance().AddOrRefreshAspect(objJoin); }
private bool HasChange(Field field) { return field.IsEntity ? !IsEqualsJoinObjects(objectUpdate, field) : !IsEqualsField(objectUpdate, field); }
public FieldValueSetter(object obj, Field field, object value) { this.obj = obj; this.field = field; this.value = value; }
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); }
private static void VerifyIsEntity(Field field) { if (field.IsEntity) DictionaryEntitiesMap.INSTANCE.TryAddEntity(field.Type); }
private object GetObjectField(object obj, Field field) { return new ValueFieldExtractor(obj, field).Extract(); }
private EntityJoin Generate(Field field) { EntityJoin join = Generate(GetEntity(field.Type), field); join.Field = field; return join; }
public ValueFieldExtractor(object objectValue, Field idField) { this.objectValue = objectValue; this.field = idField; }
private void RefreshFieldValue(object objectDictionary, Field field) { new FieldValueSetter(objectDictionary, field, GetValue(field)).Set(); }
public ValueFieldFormatted(object objectValue, Field field) { this.objectValue = objectValue; this.field = field; }
private void CopyFieldValue(object origin, object copy, Field field) { new FieldValueSetter(copy, field, GetValue(origin, field)).Set(); }