//7 SQL PC constructor ////Create a custom command with multiple custom criterias. Collection and IPersistable support public SqlServerRetrieveCommand(Map map, string cmdType, SqlCommand command, Type type, ConcurrencySupportType concurrency, bool returnCollection, IList<object> criterias) : base(map, cmdType, command, concurrency, returnCollection) { _criterias = new List<object>(); _criterias = criterias; _type = type; }
public PersistenceServer(string connectionString, string connectionName, ConcurrencySupportType concurrency) { _concurrency = concurrency; _connectionString = connectionString; _providerConnection = MakeProviderConnection(); if(connectionName != string.Empty) StoreConnectionString(_connectionString, connectionName); }
//used for Retrieve and Delete with an OID, a custom command type and concurrency support public SqlServerPersistenceCommand(Map map, ObjectIdentifier oid, SqlCommand command, string cmdType, ConcurrencySupportType concurrency) : base(map, oid, command, cmdType, concurrency) { }
//Used for Updates and Deletes with a persistent object, a custom command and concurrency suppport public SqlServerPersistenceCommand(Map map, IPersistable objectForProcess, SqlCommand command, string cmdType, ConcurrencySupportType concurrency) : base(map, objectForProcess, command, cmdType, concurrency) { }
public PersistenceServer(string connectionName, ConcurrencySupportType concurrency) { if(connectionName == string.Empty) return; _concurrency = concurrency; _connectionName = connectionName; _connectionString = GetConnectionStringByName(connectionName); _providerConnection = MakeProviderConnection(); }
public PersistenceServer(object providerConnection, ConcurrencySupportType concurrency) { _providerConnection = providerConnection; _concurrency = concurrency; }
//Retrieve all with a custom command public SqlServerRetrieveCommand(Map map, string cmdType, SqlCommand command, Type type, ConcurrencySupportType concurrency, bool returnCollection) : base(map, cmdType, command, concurrency, returnCollection) { _type = type; }
/// <summary> /// PersistentObject for CRUD (Update and delete) operations, custom command and concurrency support. /// </summary> /// <param name="map"></param> /// <param name="objectForProcess"></param> /// <param name="providerCommand"></param> /// <param name="cmdType"></param> /// <param name="concurrency"></param> public PersistenceCommand(Map map, IPersistable objectForProcess, object providerCommand, string cmdType, ConcurrencySupportType concurrency) { _providerCommand = providerCommand; _cmdMap = map.GetCommandMap(cmdType); //must get the proper command instruction from the map _pObj = objectForProcess; SetConcurrencySupport(concurrency); }
public SqlServerPersistenceServer(SqlConnection connection, ConcurrencySupportType concurrency) : base(connection, concurrency) { }
public SqlServerPersistenceServer(string connectionName, ConcurrencySupportType concurrency) : base(connectionName, concurrency) { }
protected void SetConcurrencySupport(ConcurrencySupportType concurrency) { if (concurrency == ConcurrencySupportType.None) { _optimisticField = string.Empty; _pessimisticField = string.Empty; } else if (concurrency == ConcurrencySupportType.Optimistic) { _optimisticField = PersistenceServiceConfiguration.Default.optimisticFieldName; _pessimisticField = string.Empty; } else if ((concurrency == ConcurrencySupportType.PessimisticUniqueIdentifier) || (concurrency == ConcurrencySupportType.PessimisticUserName)) { _optimisticField = string.Empty; _pessimisticField = PersistenceServiceConfiguration.Default.pessimisticFieldName; } }
/// <summary> /// PersistentCommand for custom commands, concurrency, collection and multiple processed objects support /// </summary> /// <param name="map"></param> /// <param name="cmdTypeIdentifier"></param> /// <param name="providerCommand"></param> /// <param name="concurrency"></param> /// <param name="returnCollection"></param> /// <param name="objectsForProcess"></param> public PersistenceCommand(Map map, string cmdTypeIdentifier, object providerCommand, ConcurrencySupportType concurrency, bool returnCollection, IDictionary<string,object> objectsForProcess) { _providerCommand = providerCommand; _cmdMap = map.GetCommandMap(cmdTypeIdentifier); //get the custom command instruction from the map if(!returnCollection) _pObj = MakePersistable(); _appObjs = objectsForProcess; SetConcurrencySupport(concurrency); }
/// <summary> /// PersistentObject for retrieve operations, custom command and concurrency support. /// </summary> /// <param name="map"></param> /// <param name="oid"></param> /// <param name="providerCommand"></param> /// <param name="cmdType"></param> /// <param name="concurrency"></param> public PersistenceCommand(Map map, ObjectIdentifier oid, object providerCommand, string cmdType, ConcurrencySupportType concurrency) { _providerCommand = providerCommand; _pObj = MakePersistable(null, oid);// Retrieve operations need only the OID _cmdMap = map.GetCommandMap(cmdType); //must get the proper command instruction from the map SetConcurrencySupport(concurrency); }
//Used for Retrieve custom commands that return collections. public SqlServerPersistenceCommand(Map map, string cmdType, SqlCommand command, ConcurrencySupportType concurrency, bool returnCollection) : base(map, cmdType, command, concurrency, returnCollection) { }
//Create a custom command with an OID public SqlServerRetrieveCommand(Map map, ObjectIdentifier oid, SqlCommand command, Type type, string cmdType, ConcurrencySupportType concurrency) : base(map, oid, command, cmdType, concurrency) { _type = type; }
public SqlServerPersistenceCommand(Map map, string cmdTypeIdentifier, SqlCommand command, ConcurrencySupportType concurrency, bool returnCollection, IDictionary<string,object> objectsForProcess) : base(map, cmdTypeIdentifier, command, concurrency, returnCollection, objectsForProcess) { }
//Needed for concurrency support with multiple objects and custom command public SqlServerTransactionCommand(Map map, SqlCommand command, string cmdType, ConcurrencySupportType concurrency, bool returnCollection, IDictionary<string,object> objectsForProcess) : base(map, cmdType, command, concurrency, returnCollection, objectsForProcess) { }