/// <summary>
 /// Sets the operation mode of the service object
 /// </summary>
 /// <param name="mode"></param>
 public void SetOperationMode(SqlOperationMode mode)
 {
     if (_modeSet)
     {
         return;
     }
     _modeSet = true;
     _mode    = mode;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a data operation context with
        /// </summary>
        /// <param name="serviceType">Type of data operation service</param>
        /// <param name="mode">Operation mode of the data context</param>
        public override IDataAccessOperation CreateContext(Type serviceType,
                                                           SqlOperationMode mode = SqlOperationMode.ReadWrite)
        {
            var instance = _serviceRegistry.GetService(serviceType) as IDataAccessOperation;

            if (instance == null)
            {
                throw new InvalidOperationException(
                          String.Format("Service type {0} cannot be resolved to an IDataAccessOperation instance",
                                        serviceType));
            }
            instance.SetOperationMode(mode);
            return(instance);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a context for the specified data access service with the specified operation mode
 /// </summary>
 /// <typeparam name="TService">Data access service type</typeparam>
 /// <param name="mode">Operation mode</param>
 /// <returns>Service object configured for the specified operation mode</returns>
 public static TService CreateContext <TService>(SqlOperationMode mode = SqlOperationMode.ReadWrite)
     where TService : IDataAccessOperation
 {
     return((TService)s_InternalFactory.CreateContext <TService>(mode));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a data operation context with
 /// </summary>
 /// <param name="serviceType">Type of data operation service</param>
 /// <param name="mode">Operation mode of the data context</param>
 public static IDataAccessOperation CreateContext(Type serviceType,
                                                  SqlOperationMode mode = SqlOperationMode.ReadWrite)
 {
     return(s_InternalFactory.CreateContext(serviceType, mode));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a context for the specified data access service with the specified operation mode
 /// </summary>
 /// <typeparam name="TService">Data access service type</typeparam>
 /// <param name="mode">Operation mode</param>
 /// <returns>Service object configured for the specified operation mode</returns>
 public override IDataAccessOperation CreateContext <TService>(SqlOperationMode mode = SqlOperationMode.ReadWrite)
 {
     return(CreateContext(typeof(TService), mode));
 }
 public EventedSqlDatabase(string connectionOrName, SqlOperationMode operationMode = SqlOperationMode.ReadWrite,
                           SqlDirectExecuteMode executeMode         = SqlDirectExecuteMode.Enable,
                           SqlRowVersionHandling rowVersionHandling = SqlRowVersionHandling.RaiseException)
     : base(connectionOrName, operationMode, executeMode, rowVersionHandling)
 {
 }
 /// <summary>
 /// Creates a context for the specified data access service with the specified operation mode
 /// </summary>
 /// <typeparam name="TService">Data access service type</typeparam>
 /// <param name="mode">Operation mode</param>
 /// <returns>Service object configured for the specified operation mode</returns>
 public abstract IDataAccessOperation CreateContext <TService>(SqlOperationMode mode = SqlOperationMode.ReadWrite)
     where TService : IDataAccessOperation;
 /// <summary>
 /// Creates a data operation context with
 /// </summary>
 /// <param name="serviceType">Type of data operation service</param>
 /// <param name="mode">Operation mode of the data context</param>
 public abstract IDataAccessOperation CreateContext(Type serviceType,
                                                    SqlOperationMode mode = SqlOperationMode.ReadWrite);