private void ProcessAlias(EntityJoin entity, string entityPath)
 {
     entity.Entity.GetFields()
         .OrderBy(f => f.ColumnName.Length)
         .Reverse()
         .Where(f => !f.IsEntity).ToList()
         .ForEach(field => ReplaceConditionField(entity, field, entityPath));
 }
Exemplo n.º 2
0
 private object GetJoinValue(EntityJoin join)
 {
     return new EntityLoaderBuilder()
         .Entity(join.Entity)
         .Row(Row)
         .Columns(Columns)
         .PointerIndexColumn(Pointer)
         .Dictionary(DictionaryObjectsProcessed)
         .Build();
 }
        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();
        }
Exemplo n.º 5
0
 private void LoadAliases()
 {
     TreeAliases = new EntityJoinsGenerator().Generate(this);
 }
Exemplo n.º 6
0
 private void ProcessJoin(EntityJoin join)
 {
     SetFieldValue(join.Field, GetJoinValue(join));
 }
 private void ReplaceFieldsEntity(EntityJoin entity, string entityPath = "")
 {
     ProcessAlias(entity, entityPath);
     entity.Joins.ForEach(j => ReplaceFieldsEntity(j, GetCompletedNameField(entity, entityPath)));
 }
 private bool IsEntityMain(EntityJoin entity)
 {
     return entityMain == entity.Entity;
 }
 private string GetCompletedNameField(EntityJoin entity, string entityPath)
 {
     return IsEntityMain(entity) ? entity.Name : GetNameFieldWithEntityPath(entity, entityPath);
 }
 private string GetNameFieldWithEntityPath(EntityJoin join, string entityPath)
 {
     return String.Format("{0}.{1}",entityPath, join.Field.Name);
 }
Exemplo n.º 11
0
 private bool IsEntityMain(EntityJoin join)
 {
     return join.Field == null;
 }
Exemplo n.º 12
0
 private string GetCompletedNameField(EntityJoin join, string entityPath)
 {
     return IsEntityMain(join) ? GetEntityName(join) : GetNameFieldWithEntityPath(join, entityPath);
 }
Exemplo n.º 13
0
 private static string GetEntityName(EntityJoin join)
 {
     return join.Entity.Type.Name;
 }
Exemplo n.º 14
0
 public FieldAliasReplacerBuilder Join(EntityJoin join)
 {
     this.join = join;
     return this;
 }
Exemplo n.º 15
0
 private void LoadAliases()
 {
     TreeAliases = new EntityJoinsGenerator().Generate(this);
 }