Exemplo n.º 1
0
        public void IsQuery_false_for_non_DbQueryCommandTree()
        {
            var collectionExpression =
                TypeUsage.CreateDefaultTypeUsage(
                    PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)
                        .GetCollectionType())
                    .NewEmptyCollection();

            var commandTrees = new DbCommandTree[]
                {
                    new DbInsertCommandTree(
                        new MetadataWorkspace(),
                        DataSpace.CSpace,
                        collectionExpression.Bind(),
                        new List<DbModificationClause>().AsReadOnly(),
                        collectionExpression),

                    new DbUpdateCommandTree(
                        new MetadataWorkspace(),
                        DataSpace.CSpace,
                        collectionExpression.Bind(),
                        DbExpressionBuilder.Constant(3),
                        new List<DbModificationClause>().AsReadOnly(),
                        collectionExpression),
                };

            foreach (var commandTree in commandTrees)
            {
                Assert.False(new CommandTreeFacts(commandTree).IsQuery);
            }
        }
        protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
        {
            Check.NotNull(providerManifest, "providerManifest");
            Check.NotNull(commandTree, "commandTree");

            return CreateDbCommandDefinition(providerManifest, commandTree, new DbInterceptionContext());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DbCommandInfo"/> class.
        /// </summary>
        public DbCommandInfo(DbCommandTree tree, DbCache cache, IDbCachingPolicy policy, DbTransactionInterceptor txHandler)
        {
            Debug.Assert(tree != null);
            Debug.Assert(cache != null);
            Debug.Assert(txHandler != null);

            var qryTree = tree as DbQueryCommandTree;

            if (qryTree != null)
            {
                _isModification = false;

                _affectedEntitySets = GetAffectedEntitySets(qryTree.Query);
            }
            else
            {
                _isModification = true;

                var modify = tree as DbModificationCommandTree;

                if (modify != null)
                    _affectedEntitySets = GetAffectedEntitySets(modify.Target.Expression);
                else
                    // Functions (stored procedures) are not supported.
                    Debug.Assert(tree is DbFunctionCommandTree);
            }

            _cache = cache;
            _policy = policy;
            _txHandler = txHandler;
        }
    public override string GenerateSQL(DbCommandTree commandTree)
    {
      DbFunctionCommandTree tree = (commandTree as DbFunctionCommandTree);
      EdmFunction function = tree.EdmFunction;
      CommandType = CommandType.StoredProcedure;

      string cmdText = (string)function.MetadataProperties["CommandTextAttribute"].Value;
      if (String.IsNullOrEmpty(cmdText))
      {
        string schema = (string)function.MetadataProperties["Schema"].Value;
        if (String.IsNullOrEmpty(schema))
          schema = function.NamespaceName;

        string functionName = (string)function.MetadataProperties["StoreFunctionNameAttribute"].Value;
        if (String.IsNullOrEmpty(functionName))
          functionName = function.Name;

        return String.Format("`{0}`", functionName);
      }
      else
      {
        CommandType = CommandType.Text;
        return cmdText;
      }
    }
Exemplo n.º 5
0
 public void TreeCreated(DbCommandTree commandTree, DbCommandTreeInterceptionContext interceptionContext)
 {
     if (interceptionContext.DbContexts.Contains(_context, ReferenceEquals))
     {
         _commandTrees.Add(commandTree);
     }
 }
        public virtual void VisitCommandTree(DbCommandTree commandTree)
        {
            Contract.Requires(commandTree != null);
            switch (commandTree.CommandTreeKind)
            {
                case DbCommandTreeKind.Delete:
                    VisitDeleteCommandTree((DbDeleteCommandTree)commandTree);
                    break;

                case DbCommandTreeKind.Function:
                    VisitFunctionCommandTree((DbFunctionCommandTree)commandTree);
                    break;

                case DbCommandTreeKind.Insert:
                    VisitInsertCommandTree((DbInsertCommandTree)commandTree);
                    break;

                case DbCommandTreeKind.Query:
                    VisitQueryCommandTree((DbQueryCommandTree)commandTree);
                    break;

                case DbCommandTreeKind.Update:
                    VisitUpdateCommandTree((DbUpdateCommandTree)commandTree);
                    break;

                default:
                    throw new NotSupportedException();
            }
        }
    public override string GenerateSQL(DbCommandTree tree)
    {
      DbInsertCommandTree commandTree = tree as DbInsertCommandTree;

      InsertStatement statement = new InsertStatement();

      DbExpressionBinding e = commandTree.Target;
      statement.Target = (InputFragment)e.Expression.Accept(this);

      scope.Add("target", statement.Target);

      foreach (DbSetClause setClause in commandTree.SetClauses)
        statement.Sets.Add(setClause.Property.Accept(this));

      if (values == null)
        values = new Dictionary<EdmMember, SqlFragment>();

      foreach (DbSetClause setClause in commandTree.SetClauses)
      {
        DbExpression value = setClause.Value;
        SqlFragment valueFragment = value.Accept(this);
        statement.Values.Add(valueFragment);

        if (value.ExpressionKind != DbExpressionKind.Null)
        {
          EdmMember property = ((DbPropertyExpression)setClause.Property).Property;
          values.Add(property, valueFragment);
        }
      }

      if (commandTree.Returning != null)
        statement.ReturningSelect = GenerateReturningSql(commandTree, commandTree.Returning);

      return statement.ToString();
    }
        internal static EntityCommandDefinition CreateCommandDefinition(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)
        {
            Contract.Requires(storeProviderFactory != null);
            Contract.Requires(commandTree != null);

            return new EntityCommandDefinition(storeProviderFactory, commandTree);
        }
Exemplo n.º 9
0
        internal static EntityCommandDefinition CreateCommandDefinition(DbProviderFactory storeProviderFactory, DbCommandTree commandTree)
        {
            DebugCheck.NotNull(storeProviderFactory);
            DebugCheck.NotNull(commandTree);

            return new EntityCommandDefinition(storeProviderFactory, commandTree);
        }
    public override string GenerateSQL(DbCommandTree tree)
    {
      DbUpdateCommandTree commandTree = tree as DbUpdateCommandTree;

      UpdateStatement statement = new UpdateStatement();

      _onReturningSelect = false;
      statement.Target = commandTree.Target.Expression.Accept(this);
      scope.Add("target", statement.Target as InputFragment);

      if (values == null)
        values = new Dictionary<EdmMember, SqlFragment>();

      foreach (DbSetClause setClause in commandTree.SetClauses)
      {
        statement.Properties.Add(setClause.Property.Accept(this));
        DbExpression value = setClause.Value;
        SqlFragment valueFragment = value.Accept(this);
        statement.Values.Add(valueFragment);

        if (value.ExpressionKind != DbExpressionKind.Null)
        {
          EdmMember property = ((DbPropertyExpression)setClause.Property).Property;
          values.Add(property, valueFragment);
        }
      }
      
      statement.Where = commandTree.Predicate.Accept(this);

      _onReturningSelect = true;
      if (commandTree.Returning != null)
        statement.ReturningSelect = GenerateReturningSql(commandTree, commandTree.Returning);

      return statement.ToString();
    }
        /// <summary>
        ///     Constructs a new ObjectSpanRewriter that will attempt to apply spanning to the specified query
        ///     (represented as a DbExpression) when <see cref="RewriteQuery" /> is called.
        /// </summary>
        /// <param name="toRewrite">
        ///     A <see cref="DbExpression" /> representing the query to span.
        /// </param>
        internal ObjectSpanRewriter(DbCommandTree tree, DbExpression toRewrite, AliasGenerator aliasGenerator)
        {
            DebugCheck.NotNull(toRewrite);

            _toRewrite = toRewrite;
            _tree = tree;
            _aliasGenerator = aliasGenerator;
        }
 /// <summary>
 /// Ensures that the data space of the specified command tree is the model (C-) space
 /// </summary>
 /// <param name="commandTree">The command tree for which the data space should be validated</param>
 internal override void ValidateDataSpace(DbCommandTree commandTree)
 {
     if (commandTree.DataSpace
         != DataSpace.CSpace)
     {
         throw new ProviderIncompatibleException(Strings.EntityClient_RequiresNonStoreCommandTree);
     }
 }
        /// <summary>
        ///     Create a Command Definition object, given the connection and command tree
        /// </summary>
        /// <param name="connection"> connection to the underlying provider </param>
        /// <param name="commandTree"> command tree for the statement </param>
        /// <returns> an executable command definition object </returns>
        /// <exception cref="ArgumentNullException">connection and commandTree arguments must not be null</exception>
        protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
        {
            Check.NotNull(providerManifest, "providerManifest");
            Check.NotNull(commandTree, "commandTree");

            var storeMetadata = (StoreItemCollection)commandTree.MetadataWorkspace.GetItemCollection(DataSpace.SSpace);
            return CreateCommandDefinition(storeMetadata.StoreProviderFactory, commandTree);
        }
        internal static EntityCommandDefinition CreateCommandDefinition(
            DbProviderFactory storeProviderFactory, DbCommandTree commandTree, IDbDependencyResolver resolver = null)
        {
            DebugCheck.NotNull(storeProviderFactory);
            DebugCheck.NotNull(commandTree);

            return new EntityCommandDefinition(storeProviderFactory, commandTree, resolver);
        }
Exemplo n.º 15
0
        internal ParseResult(DbCommandTree commandTree, List<FunctionDefinition> functionDefs)
        {
            DebugCheck.NotNull(commandTree);
            DebugCheck.NotNull(functionDefs);

            _commandTree = commandTree;
            _functionDefs = new ReadOnlyCollection<FunctionDefinition>(functionDefs);
        }
Exemplo n.º 16
0
        /// <summary>
        ///     Constructs a new ObjectSpanRewriter that will attempt to apply spanning to the specified query
        ///     (represented as a DbExpression) when <see cref="RewriteQuery" /> is called.
        /// </summary>
        /// <param name="toRewrite"> A <see cref="DbExpression" /> representing the query to span. </param>
        internal ObjectSpanRewriter(DbCommandTree tree, DbExpression toRewrite, AliasGenerator aliasGenerator)
        {
            Debug.Assert(toRewrite != null, "Expression to rewrite cannot be null");

            _toRewrite = toRewrite;
            _tree = tree;
            _aliasGenerator = aliasGenerator;
        }
Exemplo n.º 17
0
        internal ParseResult(DbCommandTree commandTree, List<FunctionDefinition> functionDefs)
        {
            Contract.Requires(commandTree != null);
            Contract.Requires(functionDefs != null);

            _commandTree = commandTree;
            _functionDefs = functionDefs.AsReadOnly();
        }
Exemplo n.º 18
0
 protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
 {
     return new CachingCommandDefinition(
         _providerServices.CreateCommandDefinition(providerManifest, commandTree), 
         new CommandTreeFacts(commandTree),
         _cacheTransactionHandler,
         _cachingPolicy);
 }
Exemplo n.º 19
0
        /// <summary>
        ///     Create a Command Definition object given a command tree.
        /// </summary>
        /// <param name="commandTree"> command tree for the statement </param>
        /// <returns> an executable command definition object </returns>
        /// <remarks>
        ///     This method simply delegates to the provider's implementation of CreateDbCommandDefinition.
        /// </remarks>
        public DbCommandDefinition CreateCommandDefinition(DbCommandTree commandTree)
        {
            Contract.Requires(commandTree != null);
            ValidateDataSpace(commandTree);
            var storeMetadata = (StoreItemCollection)commandTree.MetadataWorkspace.GetItemCollection(DataSpace.SSpace);
            Contract.Assert(storeMetadata.StoreProviderManifest != null, "StoreItemCollection has null StoreProviderManifest?");

            return CreateDbCommandDefinition(storeMetadata.StoreProviderManifest, commandTree);
        }
        protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
        {
            Debug.Assert(providerManifest != null, "CreateCommandDefinition passed null provider manifest to CreateDbCommandDefinition?");
            Debug.Assert(commandTree != null, "CreateCommandDefinition did not validate commandTree argument?");

            var prototype = CreateCommand(providerManifest, commandTree);
            var result = CreateCommandDefinition(prototype);
            return result;
        }
    protected override DbCommandDefinition CreateDbCommandDefinition(
        DbProviderManifest providerManifest, DbCommandTree commandTree)
    {
      if (commandTree == null)
        throw new ArgumentNullException("commandTree");

      SqlGenerator generator = null;
      if (commandTree is DbQueryCommandTree)
        generator = new SelectGenerator();
      else if (commandTree is DbInsertCommandTree)
        generator = new InsertGenerator();
      else if (commandTree is DbUpdateCommandTree)
        generator = new UpdateGenerator();
      else if (commandTree is DbDeleteCommandTree)
        generator = new DeleteGenerator();
      else if (commandTree is DbFunctionCommandTree)
        generator = new FunctionGenerator();

      string sql = generator.GenerateSQL(commandTree);

      EFMySqlCommand cmd = new EFMySqlCommand();
      cmd.CommandText = sql;
      if (generator is FunctionGenerator)
        cmd.CommandType = (generator as FunctionGenerator).CommandType;

      SetExpectedTypes(commandTree, cmd);

      EdmFunction function = null;
      if (commandTree is DbFunctionCommandTree)
        function = (commandTree as DbFunctionCommandTree).EdmFunction;

      // Now make sure we populate the command's parameters from the CQT's parameters:
      foreach (KeyValuePair<string, TypeUsage> queryParameter in commandTree.Parameters)
      {
        DbParameter parameter = cmd.CreateParameter();
        parameter.ParameterName = queryParameter.Key;
        parameter.Direction = ParameterDirection.Input;
        parameter.DbType = Metadata.GetDbType(queryParameter.Value);

        FunctionParameter funcParam;
        if (function != null &&
            function.Parameters.TryGetValue(queryParameter.Key, false, out funcParam))
        {
          parameter.ParameterName = funcParam.Name;
          parameter.Direction = Metadata.ModeToDirection(funcParam.Mode);
          parameter.DbType = Metadata.GetDbType(funcParam.TypeUsage);
        }
        cmd.Parameters.Add(parameter);
      }

      // Now add parameters added as part of SQL gen 
      foreach (DbParameter p in generator.Parameters)
        cmd.Parameters.Add(p);

      return CreateCommandDefinition(cmd);
    }
        public virtual DbCommandTree Created(DbCommandTree commandTree, DbInterceptionContext interceptionContext)
        {
            DebugCheck.NotNull(commandTree);
            DebugCheck.NotNull(interceptionContext);

            return _internalDispatcher.Dispatch(
                commandTree,
                new DbCommandTreeInterceptionContext(interceptionContext),
                (i, c) => i.TreeCreated(c));
        }
        protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
        {
            var entityCommandDefinition = EntityCommandDefinition;
            if (entityCommandDefinition == null)
            {
                entityCommandDefinition = new Mock<EntityCommandDefinition>(MockBehavior.Loose, null, null, null).Object;
            }

            return entityCommandDefinition;
        }
        internal override DbCommandDefinition CreateDbCommandDefinition(
            DbProviderManifest providerManifest,
            DbCommandTree commandTree,
            DbInterceptionContext interceptionContext)
        {
            DebugCheck.NotNull(providerManifest);
            DebugCheck.NotNull(commandTree);
            DebugCheck.NotNull(interceptionContext);

            var storeMetadata = (StoreItemCollection)commandTree.MetadataWorkspace.GetItemCollection(DataSpace.SSpace);
            return CreateCommandDefinition(storeMetadata.StoreProviderFactory, commandTree, interceptionContext);
        }
    public override string GenerateSQL(DbCommandTree tree)
    {
      DbDeleteCommandTree commandTree = tree as DbDeleteCommandTree;

      DeleteStatement statement = new DeleteStatement();

      statement.Target = commandTree.Target.Expression.Accept(this);
      scope.Add("target", statement.Target as InputFragment);

      statement.Where = commandTree.Predicate.Accept(this);

      return statement.ToString();
    }
Exemplo n.º 26
0
        public CommandTreeFacts(DbCommandTree commandTree)
        {
            IsQuery = commandTree is DbQueryCommandTree;

            var visitor = new CommandTreeVisitor();

            if (commandTree.CommandTreeKind == DbCommandTreeKind.Function)
            {
                var edmFunction = ((DbFunctionCommandTree)commandTree).EdmFunction;

                var containerMapping =
                    commandTree.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace).GetItems<EntityContainerMapping>().Single();

                var entitySetMappings =
                containerMapping.EntitySetMappings.Where(
                    esm => esm.ModificationFunctionMappings.Any(
                        mfm => mfm.DeleteFunctionMapping.Function == edmFunction ||
                        mfm.InsertFunctionMapping.Function == edmFunction ||
                        mfm.UpdateFunctionMapping.Function == edmFunction));

                AffectedEntitySets =
                    (from esm in entitySetMappings
                    from etm in esm.EntityTypeMappings
                    from mappingFragment in etm.Fragments.Where(f => f.StoreEntitySet != null)
                    select mappingFragment.StoreEntitySet).Cast<EntitySetBase>().ToList().AsReadOnly();
            }
            else
            {
                if (commandTree.CommandTreeKind == DbCommandTreeKind.Query)
                {
                    ((DbQueryCommandTree)commandTree).Query.Accept(visitor);
                }
                else
                {
                    Debug.Assert(commandTree is DbModificationCommandTree, "Unexpected command tree kind");

                    ((DbModificationCommandTree)commandTree).Target.Expression.Accept(visitor);
                }

                AffectedEntitySets = new ReadOnlyCollection<EntitySetBase>(visitor.EntitySets);
                UsesNonDeterministicFunctions =
                    visitor.Functions.Any(f => NonDeterministicFunctions.Contains(
                            string.Format("{0}.{1}", f.NamespaceName, f.Name)));
            }

            MetadataWorkspace = commandTree.MetadataWorkspace;
        }
    public override string GenerateSQL(DbCommandTree tree)
    {
      DbQueryCommandTree commandTree = tree as DbQueryCommandTree;

      SqlFragment fragment = null;

      DbExpression e = commandTree.Query;
      switch (commandTree.Query.ExpressionKind)
      {
        case DbExpressionKind.Project:
          fragment = e.Accept(this);
          Debug.Assert(fragment is SelectStatement);
          break;
      }

      return fragment.ToString();
    }
Exemplo n.º 28
0
        /// <summary>
        ///     Create a Command Definition object given a command tree.
        /// </summary>
        /// <param name="commandTree"> command tree for the statement </param>
        /// <returns> an executable command definition object </returns>
        /// <remarks>
        ///     This method simply delegates to the provider's implementation of CreateDbCommandDefinition.
        /// </remarks>
        public DbCommandDefinition CreateCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
        {
            Contract.Requires(providerManifest != null);
            Contract.Requires(commandTree != null);

            try
            {
                return CreateDbCommandDefinition(providerManifest, commandTree);
            }
            catch (ProviderIncompatibleException)
            {
                throw;
            }
            catch (Exception e)
            {
                if (e.IsCatchableExceptionType())
                {
                    throw new ProviderIncompatibleException(Strings.ProviderDidNotCreateACommandDefinition, e);
                }
                throw;
            }
        }
Exemplo n.º 29
0
        internal ObjectFullSpanRewriter(DbCommandTree tree, DbExpression toRewrite, Span span, AliasGenerator aliasGenerator)
            : base(tree, toRewrite, aliasGenerator)
        {
            Debug.Assert(span != null, "Span cannot be null");
            Debug.Assert(span.SpanList.Count > 0, "At least one span path is required");

            // Retrieve the effective 'T' of the ObjectQuery<T> that produced
            // the Command Tree that is being rewritten. This could be either
            // literally 'T' or Collection<T>.
            EntityType entityType = null;
            if (!TryGetEntityType(Query.ResultType, out entityType))
            {
                // If the result type of the query is neither an Entity type nor a collection
                // type with an Entity element type, then full Span is currently not allowed.
                throw new InvalidOperationException(Strings.ObjectQuery_Span_IncludeRequiresEntityOrEntityCollection);
            }

            // Construct the SpanPathInfo navigation property tree using the
            // list of Include Span paths from the Span object:
            // Create a SpanPathInfo instance that represents the root of the tree
            // and takes its Entity type from the Entity type of the result type of the query.
            var spanRoot = new SpanPathInfo(entityType);

            // Populate the tree of navigation properties based on the navigation property names
            // in the Span paths from the Span object. Commonly rooted span paths are merged, so
            // that paths of "Customer.Order" and "Customer.Address", for example, will share a
            // common SpanPathInfo for "Customer" in the Children collection of the root SpanPathInfo,
            // and that SpanPathInfo will contain one child for "Order" and another for "Address".
            foreach (var path in span.SpanList)
            {
                AddSpanPath(spanRoot, path.Navigations);
            }

            // The 'current' span path is initialized to the root of the Include span tree
            _currentSpanPath.Push(spanRoot);
        }
Exemplo n.º 30
0
 public abstract void TreeCreated(DbCommandTree commandTree, DbCommandTreeInterceptionContext interceptionContext);
Exemplo n.º 31
0
 // <summary>
 // Internal constructor for a ProviderCommandInfo object
 // </summary>
 // <param name="commandTree"> command tree for the provider command </param>
 internal ProviderCommandInfo(cqt.DbCommandTree commandTree)
 {
     _commandTree = commandTree;
 }
Exemplo n.º 32
0
 /// <summary>
 ///     private constructor
 /// </summary>
 /// <param name="ctree"> the input cqt </param>
 private PlanCompiler(cqt.DbCommandTree ctree)
 {
     m_ctree = ctree; // the input command tree
 }
Exemplo n.º 33
0
 /// <summary>
 /// Initializes a new instance of the DbCommandDefinitionWrapper class.
 /// </summary>
 /// <param name="wrappedCommandDefinition">The wrapped command definition.</param>
 /// <param name="commandTree">The command tree.</param>
 /// <param name="commandCreator">The command creator delegate.</param>
 public DbCommandDefinitionWrapper(System.Data.Entity.Core.Common.DbCommandDefinition wrappedCommandDefinition, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree, Func <DbCommand, DbCommandDefinitionWrapper, DbCommand> commandCreator)
 {
     this.wrappedCommandDefinition = wrappedCommandDefinition;
     this.commandTree    = commandTree;
     this.commandCreator = commandCreator;
 }
Exemplo n.º 34
0
 /// <summary>
 /// Creates the command definition wrapper.
 /// </summary>
 /// <param name="wrappedCommandDefinition">The wrapped command definition.</param>
 /// <param name="commandTree">The command tree.</param>
 /// <returns>
 /// The <see cref="DbCommandDefinitionWrapper"/> object.
 /// </returns>
 public override DbCommandDefinitionWrapper CreateCommandDefinitionWrapper(DbCommandDefinition wrappedCommandDefinition, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree)
 {
     return(new EFCachingCommandDefinition(wrappedCommandDefinition, commandTree));
 }
Exemplo n.º 35
0
 /// <summary>
 /// Creates the command definition wrapper.
 /// </summary>
 /// <param name="wrappedCommandDefinition">The wrapped command definition.</param>
 /// <param name="commandTree">The command tree.</param>
 /// <returns><see cref="DbCommandDefinitionWrapper"/> object.</returns>
 public virtual DbCommandDefinitionWrapper CreateCommandDefinitionWrapper(System.Data.Entity.Core.Common.DbCommandDefinition wrappedCommandDefinition, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree)
 {
     return(new DbCommandDefinitionWrapper(wrappedCommandDefinition, commandTree, (cmd, def) => EFDbCommandFactory.GetCommandWrapper(cmd, def)));
 }
Exemplo n.º 36
0
        /// <summary>
        /// Creates the command definition wrapper for a given provider manifest and command tree.
        /// </summary>
        /// <param name="providerManifest">The provider manifest.</param>
        /// <param name="commandTree">The command tree.</param>
        /// <returns><see cref="DbCommandDefinition"/> object.</returns>
        protected override System.Data.Entity.Core.Common.DbCommandDefinition CreateDbCommandDefinition(System.Data.Entity.Core.Common.DbProviderManifest providerManifest, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree)
        {
            var wrapperManifest = (DbProviderManifestWrapper)providerManifest;
            var createDbCommandDefinitionFunction = this.GetCreateDbCommandDefinitionFunction(wrapperManifest.WrappedProviderManifestInvariantName);

            System.Data.Entity.Core.Common.DbCommandDefinition definition = createDbCommandDefinitionFunction(wrapperManifest.WrappedProviderManifest, commandTree);
            return(this.CreateCommandDefinitionWrapper(definition, commandTree));
        }
Exemplo n.º 37
0
        protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest dbProviderManifest, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree dbCommandTree)
        {
            DbCommandDefinition dbCommandDefinition = base.CreateCommandDefinition(dbProviderManifest, dbCommandTree);

            return(new EFCachingCommandDefinition(dbCommandDefinition, dbCommandTree));
        }
Exemplo n.º 38
0
 internal EFCachingCommandDefinition(System.Data.Entity.Core.Common.DbCommandDefinition wrappedCommandDefinition, System.Data.Entity.Core.Common.CommandTrees.DbCommandTree commandTree)
     : base(wrappedCommandDefinition, commandTree, (cmd, def) => EFDbCommandFactory.GetCommandWrapper(cmd, def))
 {
     this.GetAffectedEntitySets(commandTree);
 }