コード例 #1
0
        /// <summary>
        /// Get the DbCommand instance from the policies defined
        /// </summary>
        /// <param name="wrappedCommand"></param>
        /// <param name="commandDefinition"></param>
        /// <returns></returns>
        public static DbCommandWrapper GetCommandWrapper(DbCommand wrappedCommand, DbCommandDefinitionWrapper commandDefinition)
        {
            Application.ApplicationMode mode = Application.Instance.Mode;
            EFCachingCommandDefinition  efCommandDefinition = new EFCachingCommandDefinition(commandDefinition, commandDefinition.CommandTree);

            switch (mode)
            {
            case Application.ApplicationMode.Analysis:
                return(new EFAnalysisCommand(wrappedCommand, efCommandDefinition));

            case Application.ApplicationMode.Cache:
                return(new EFCachingCommand(wrappedCommand, efCommandDefinition));

            default:
                return(new DbCommandWrapper(wrappedCommand, efCommandDefinition));
            }
        }
コード例 #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()
        {
            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));
            }
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the EFCachingCommand class.
 /// </summary>
 /// <param name="wrappedCommand">The wrapped command.</param>
 /// <param name="commandDefinition">The command definition.</param>
 public EFCachingCommand(System.Data.Common.DbCommand wrappedCommand, EFCachingCommandDefinition commandDefinition)
     : base(wrappedCommand, commandDefinition)
 {
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the EFAnalysisCommand class.
 /// </summary>
 /// <param name="wrappedCommand">The wrapped command.</param>
 /// <param name="commandDefinition">The command definition.</param>
 public EFAnalysisCommand(DbCommand wrappedCommand, EFCachingCommandDefinition commandDefinition)
     : base(wrappedCommand, commandDefinition)
 {
 }