/// <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)); } }
/// <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)); } }
/// <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) { }
/// <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) { }