Exemplo n.º 1
0
        public SingleParameterLambdaState(ParameterExpression parameter)
        {
            _singleEntityName = parameter.Name;
            var entityMapping = DataEntityMapping.GetEntityMapping(parameter.Type);

            _singleEntityMap = entityMapping.GetRelationMap();
        }
Exemplo n.º 2
0
        public RelateParameterLambdaState(ParameterExpression parameter, LambdaState state)
        {
            var entityMapping = DataEntityMapping.GetEntityMapping(parameter.Type);

            _singleEntityName = parameter.Name;
            _singleEntityMap  = entityMapping.GetRelationMap();
            _state            = state;
        }
Exemplo n.º 3
0
        public SingleParameterLambdaState(ParameterExpression parameter)
        {
            this.singleEntityName = parameter.Name;
            Type type = parameter.Type;
            DataEntityMapping entityMapping = DataEntityMapping.GetEntityMapping(type);

            this.singleEntityMap = entityMapping.GetRelationMap();
        }
Exemplo n.º 4
0
 public RelationMap GetRelationMap()
 {
     if (this.relationMap == null)
     {
         lock (joinLock) {
             if (this.relationMap == null)
             {
                 this.relationMap = new RelationMap(this);
             }
         }
     }
     return(this.relationMap);
 }
Exemplo n.º 5
0
        public virtual QueryCommand SelectInsert(DataContext context, InsertSelector selector, DataEntityMapping mapping, QueryExpression query, OrderExpression order, bool distinct)
        {
            RelationMap    relationMap = mapping.GetRelationMap();
            CommandData    commandData;
            CreateSqlState state = new CreateSqlState(context);

            if (mapping.HasJoinRelateModel)
            {
                QueryExpression subQuery  = null;
                QueryExpression mainQuery = null;
                OrderExpression subOrder  = null;
                OrderExpression mainOrder = null;
                if (query != null)
                {
                    if (query.MutliQuery)
                    {
                        mainQuery = query;
                    }
                    else
                    {
                        subQuery = query;
                    }
                }
                if (order != null)
                {
                    if (order.MutliOrder)
                    {
                        mainOrder = order;
                    }
                    else
                    {
                        subOrder = order;
                    }
                }
                List <IJoinModel> models = relationMap.CreateJoinModels(subQuery, subOrder);
                commandData = _factory.CreateSelectInsertCommand(selector, models, mainQuery, mainOrder, distinct, state);
            }
            else
            {
                commandData = _factory.CreateSelectInsertCommand(selector, mapping, query, order, distinct, state);
            }
            DbCommand    command      = commandData.CreateCommand(this, state);
            QueryCommand queryCommand = new QueryCommand()
            {
                Command = command
            };

            return(queryCommand);
        }
Exemplo n.º 6
0
        public virtual QueryCommand QueryEntityData(DataContext context, DataEntityMapping mapping, ISelector selector, QueryExpression query, OrderExpression order, bool distinct, Region region)
        {
            RelationMap relationMap = mapping.GetRelationMap();

            if (selector == null)
            {
                selector = relationMap.GetDefaultSelector();
            }
            CreateSqlState state       = new CreateSqlState(context);
            CommandData    commandData = _factory.CreateSelectDataCommand(mapping, relationMap, selector, query, order, distinct, region, state);
            DbCommand      command     = commandData.CreateCommand(this, state);
            QueryState     queryState  = new QueryState();

            queryState.SetRelationMap(relationMap);
            queryState.SetSelector(selector);
            QueryCommand queryCommand = new QueryCommand()
            {
                Command   = command,
                InnerPage = commandData.InnerPage,
                State     = queryState
            };

            return(queryCommand);
        }
Exemplo n.º 7
0
 public void SetRelationMap(RelationMap relationMap)
 {
     this.relationMap = relationMap;
 }
Exemplo n.º 8
0
 public void SetRelationMap(RelationMap relationMap)
 {
     _relationMap = relationMap;
 }