Esempio n. 1
0
        public virtual IStorageProviderCommand <IEnumerable <DataContainer>, IRdbmsProviderCommandExecutionContext> CreateForDataContainerQuery(IQuery query)
        {
            ArgumentUtility.CheckNotNull("query", query);

            var dbCommandBuilder    = CreateDbCommandBuilder(query);
            var dataContainerReader = _objectReaderFactory.CreateDataContainerReader();

            return(new MultiObjectLoadCommand <DataContainer> (new[] { Tuple.Create(dbCommandBuilder, dataContainerReader) }));
        }
Esempio n. 2
0
        public virtual IStorageProviderCommand <ObjectLookupResult <DataContainer>, IRdbmsProviderCommandExecutionContext> CreateForSingleIDLookup(ObjectID objectID)
        {
            ArgumentUtility.CheckNotNull("objectID", objectID);

            var tableDefinition     = _tableDefinitionFinder.GetTableDefinition(objectID);
            var selectedColumns     = tableDefinition.GetAllColumns().ToArray();
            var dataContainerReader = _objectReaderFactory.CreateDataContainerReader(tableDefinition, selectedColumns);
            var comparedColumns     = tableDefinition.ObjectIDProperty.SplitValueForComparison(objectID);
            var dbCommandBuilder    = _dbCommandBuilderFactory.CreateForSelect(tableDefinition, selectedColumns, comparedColumns, new OrderedColumn[0]);

            var loadCommand = new SingleObjectLoadCommand <DataContainer> (dbCommandBuilder, dataContainerReader);

            return(new SingleDataContainerAssociateWithIDCommand <IRdbmsProviderCommandExecutionContext> (objectID, loadCommand));
        }
        protected virtual IStorageProviderCommand <IEnumerable <DataContainer>, IRdbmsProviderCommandExecutionContext> CreateForDirectRelationLookup(
            TableDefinition tableDefinition,
            RelationEndPointDefinition foreignKeyEndPoint,
            ObjectID foreignKeyValue,
            SortExpressionDefinition sortExpression)
        {
            var selectedColumns     = tableDefinition.GetAllColumns();
            var dataContainerReader = _objectReaderFactory.CreateDataContainerReader(tableDefinition, selectedColumns);

            var dbCommandBuilder = _dbCommandBuilderFactory.CreateForSelect(
                tableDefinition,
                selectedColumns,
                GetComparedColumns(foreignKeyEndPoint, foreignKeyValue),
                GetOrderedColumns(sortExpression));

            return(new MultiObjectLoadCommand <DataContainer> (new[] { Tuple.Create(dbCommandBuilder, dataContainerReader) }));
        }