Ejemplo n.º 1
0
        private string GetColumnNameWithAs(string source, string key)
        {
            var name   = FluentEntityAdoHelper.ConcatTableColumn(source, key);
            var nameAs = FluentEntityAdoHelper.ConcatTableColumnAs(source, key);

            return($"{name} AS {nameAs}");
        }
Ejemplo n.º 2
0
        private IFluentEntityJoin <T> GenericJoin <TJoin1, TJoin2, TKey1, TKey2>(
            Expression <Func <T, TJoin2> > property,
            Expression <Func <TJoin1, TKey1> > onColumn1,
            Expression <Func <TJoin2, TKey2> > onColumn2,
            string joinCommand) where TJoin2 : new()
        {
            FluentEntityProperty <EntityColumnRefAttribute> joinedProperty = null;

            if (property != null)
            {
                joinedProperty = FluentEntityAdoHelper.GetColumnRefProperty(property);
            }
            var tableSource         = FluentEntityAdoHelper.GetTableName(typeof(TJoin1));
            var tableDestination    = FluentEntityAdoHelper.GetTableName(typeof(TJoin2));
            var propertySource      = FluentEntityAdoHelper.ConcatTableColumn(tableSource, FluentEntityAdoHelper.GetColumnPropertyName(onColumn1));
            var propertyDestination = FluentEntityAdoHelper.ConcatTableColumn(tableDestination, FluentEntityAdoHelper.GetColumnPropertyName(onColumn2));

            _joinCommandBuilder.Append($" {joinCommand} {tableDestination} ON {propertySource} = {propertyDestination}");
            TableJoined <TJoin2>(tableSource, tableDestination, joinedProperty, new TJoin2());

            return(this);
        }