コード例 #1
0
        /// <summary>
        /// Creates and returns a <see cref="T:System.Data.Common.DbCommandDefinition"/> object associated with the current connection.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.Data.Common.DbCommandDefinition"/>.
        /// </returns>
        public override DbCommand CreateCommand()
        {
            Application.ApplicationMode mode = Application.Instance.Mode;
            EFCachingCommandDefinition  commandDefinition = new EFCachingCommandDefinition(WrappedCommandDefinition, CommandTree);

            switch (mode)
            {
            case Application.ApplicationMode.Analysis:
                return(new EFAnalysisCommand(WrappedCommandDefinition.CreateCommand(), commandDefinition));

            case Application.ApplicationMode.Cache:
                return(new EFCachingCommand(WrappedCommandDefinition.CreateCommand(), commandDefinition));

            default:
                return(new DbCommandWrapper(WrappedCommandDefinition.CreateCommand(), commandDefinition));
            }
        }
コード例 #2
0
 /// <summary>
 /// Creates and returns a <see cref="T:System.Data.Common.DbCommandDefinition"/> object associated with the current connection.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.Data.Common.DbCommandDefinition"/>.
 /// </returns>
 public override DbCommand CreateCommand()
 {
     return(new EFCachingCommand(WrappedCommandDefinition.CreateCommand(), this));
 }