/// <summary> /// Constructs the EntityCommand object not yet associated to a connection object /// </summary> public EntityCommand() { GC.SuppressFinalize(this); // Initalize the member field with proper default values this._designTimeVisible = true; this._commandType = CommandType.Text; this._updatedRowSource = UpdateRowSource.Both; this._parameters = new EntityParameterCollection(); // Future Enhancement: (See SQLPT #300004256) At some point it would be // really nice to read defaults from a global configuration, but we're not // doing that today. this._enableQueryPlanCaching = true; }
internal EntityCommand(EntityDataReaderFactory factory) { // Initalize the member field with proper default values _designTimeVisible = true; _commandType = CommandType.Text; _updatedRowSource = UpdateRowSource.Both; _parameters = new EntityParameterCollection(); // Future Enhancement: (See SQLPT #300004256) At some point it would be // really nice to read defaults from a global configuration, but we're not // doing that today. _enableQueryPlanCaching = true; _entityDataReaderFactory = factory ?? new EntityDataReaderFactory(); }
/// <summary> /// Internal constructor used by EntityCommandDefinition /// </summary> /// <param name="commandDefinition">The prepared command definition that can be executed using this EntityCommand</param> internal EntityCommand(EntityCommandDefinition commandDefinition) : this() { // Assign other member fields from the parameters this._commandDefinition = commandDefinition; this._parameters = new EntityParameterCollection(); // Make copies of the parameters foreach (EntityParameter parameter in commandDefinition.Parameters) { this._parameters.Add(parameter.Clone()); } // Reset the dirty flag that was set to true when the parameters were added so that it won't say // it's dirty to start with this._parameters.ResetIsDirty(); // Track the fact that this command was created from and represents an already prepared command definition this._isCommandDefinitionBased = true; }
/// <summary> /// Internal constructor used by EntityCommandDefinition /// </summary> /// <param name="commandDefinition">The prepared command definition that can be executed using this EntityCommand</param> internal EntityCommand(EntityCommandDefinition commandDefinition, EntityDataReaderFactory factory = null) : this(factory) { // Assign other member fields from the parameters _commandDefinition = commandDefinition; _parameters = new EntityParameterCollection(); // Make copies of the parameters foreach (var parameter in commandDefinition.Parameters) { _parameters.Add(parameter.Clone()); } // Reset the dirty flag that was set to true when the parameters were added so that it won't say // it's dirty to start with _parameters.ResetIsDirty(); // Track the fact that this command was created from and represents an already prepared command definition _isCommandDefinitionBased = true; }