public virtual IEnumerable <IStatementBase> Build(IDataAccessContext context)
        {
            switch (context.Method)
            {
            case DataAccessMethod.Select:
                return(this.GetBuilder(ref _select, () => this.CreateSelectStatementBuilder()).Build((DataSelectContext)context));

            case DataAccessMethod.Delete:
                return(this.GetBuilder(ref _delete, () => this.CreateDeleteStatementBuilder()).Build((DataDeleteContext)context));

            case DataAccessMethod.Insert:
                return(this.GetBuilder(ref _insert, () => this.CreateInsertStatementBuilder()).Build((DataInsertContext)context));

            case DataAccessMethod.Update:
                return(this.GetBuilder(ref _update, () => this.CreateUpdateStatementBuilder()).Build((DataUpdateContext)context));

            case DataAccessMethod.Upsert:
                return(this.GetBuilder(ref _upsert, () => this.CreateUpsertStatementBuilder()).Build((DataUpsertContext)context));

            case DataAccessMethod.Count:
                return(this.GetBuilder(ref _count, () => this.CreateCountStatementBuilder()).Build((DataCountContext)context));

            case DataAccessMethod.Exists:
                return(this.GetBuilder(ref _exist, () => this.CreateExistStatementBuilder()).Build((DataExistContext)context));

            case DataAccessMethod.Execute:
                return(this.GetBuilder(ref _execution, () => this.CreateExecutionStatementBuilder()).Build((DataExecuteContext)context));

            case DataAccessMethod.Increment:
                return(this.GetBuilder(ref _increment, () => this.CreateIncrementStatementBuilder()).Build((DataIncrementContext)context));

            default:
                throw new DataException($"Unsupported data access '{context.Method}' operation.");
            }
        }
Exemplo n.º 2
0
        public static void Init()
        {
            System = new TestSystem();
            System.Start();

            DataContext = System.Configuration.Container.Get<IDataAccessContext>();
        }
Exemplo n.º 3
0
 public void Execute(IDataAccessContext context, TStatement statement)
 {
     if (context is IDataMutateContext ctx)
     {
         this.OnExecute(ctx, statement);
     }
 }
Exemplo n.º 4
0
 public void Execute(IDataAccessContext context, CountStatement statement)
 {
     if (context is DataCountContext ctx)
     {
         this.OnExecute(ctx, statement);
     }
 }
Exemplo n.º 5
0
            protected DataAccessContextScenario()
            {
                Provider = A.Fake<IDataAccessProvider>();
                DataContext = new DefaultDataAccessContext(Provider);

                A.CallTo(() => Provider.SessionFactory.Open())
                 .ReturnsLazily(_ => A.Dummy<IDataSession>());
            }
Exemplo n.º 6
0
        public bool Execute(IDataAccessContext context, AggregateStatement statement)
        {
            if (context is DataAggregateContext ctx)
            {
                return(this.OnExecute(ctx, statement));
            }

            throw new DataException($"Data Engine Error: The '{this.GetType().Name}' executor does not support execution of '{context.GetType().Name}' context.");
        }
Exemplo n.º 7
0
		public UnitOfWork(IDataAccessContext context,
			IUserManagerProxy userManagerProxy,
			ICategoryLogRepository<CategoryLog> categoryLog
			)
		{
			this.context = context as DataAccessContext;
			this.UserManager = userManagerProxy;
			this.CategoryLogRepository = categoryLog;

		}
Exemplo n.º 8
0
            public void Execute(IDataAccessContext context, IStatementBase statement)
            {
                bool continued;

                switch (statement)
                {
                case SelectStatement select:
                    continued = _select.Execute(context, select);
                    break;

                case DeleteStatement delete:
                    continued = _delete.Execute(context, delete);
                    break;

                case InsertStatement insert:
                    continued = _insert.Execute(context, insert);
                    break;

                case UpdateStatement update:
                    continued = _update.Execute(context, update);
                    break;

                case UpsertStatement upsert:
                    continued = _upsert.Execute(context, upsert);
                    break;

                case ExistStatement exist:
                    continued = _exist.Execute(context, exist);
                    break;

                case ExecutionStatement execution:
                    continued = _execution.Execute(context, execution);
                    break;

                case AggregateStatement aggregate:
                    continued = _aggregate.Execute(context, aggregate);
                    break;

                default:
                    continued = context.Session.Build(statement).ExecuteNonQuery() > 0;
                    break;
                }

                if (continued && statement.HasSlaves)
                {
                    foreach (var slave in statement.Slaves)
                    {
                        this.Execute(context, slave);
                    }
                }
            }
Exemplo n.º 9
0
        public bool Execute(IDataAccessContext context, SelectStatement statement)
        {
            switch (context)
            {
            case DataSelectContext selection:
                return(this.OnExecute(selection, statement));

            case DataInsertContext insertion:
                return(this.OnExecute(insertion, statement));

            case DataIncrementContext increment:
                return(this.OnExecute(increment, statement));
            }

            throw new DataException($"Data Engine Error: The '{this.GetType().Name}' executor does not support execution of '{context.GetType().Name}' context.");
        }
Exemplo n.º 10
0
        public void Execute(IDataAccessContext context, SelectStatement statement)
        {
            switch (context)
            {
            case DataSelectContext selection:
                this.OnExecute(selection, statement);
                break;

            case DataInsertContext insertion:
                this.OnExecute(insertion, statement);
                break;

            case DataIncrementContext increment:
                this.OnExecute(increment, statement);
                break;
            }
        }
Exemplo n.º 11
0
            public void Execute(IDataAccessContext context, IStatementBase statement)
            {
                switch (statement)
                {
                case SelectStatement select:
                    _select.Execute(context, select);
                    break;

                case DeleteStatement delete:
                    _delete.Execute(context, delete);
                    break;

                case InsertStatement insert:
                    _insert.Execute(context, insert);
                    break;

                case UpdateStatement update:
                    _update.Execute(context, update);
                    break;

                case UpsertStatement upsert:
                    _upsert.Execute(context, upsert);
                    break;

                case CountStatement count:
                    _count.Execute(context, count);
                    break;

                case ExistStatement exist:
                    _exist.Execute(context, exist);
                    break;

                case ExecutionStatement execution:
                    _execution.Execute(context, execution);
                    break;

                default:
                    context.Session.Build(statement).ExecuteNonQuery();
                    break;
                }
            }
		public UserManagerProxy(IDataAccessContext context)
		{
			this.UserManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>((DataAccessContext)context));
		}
Exemplo n.º 13
0
 public static IEnumerable <Common.Expressions.IStatementBase> Build(this IDataAccessContext context)
 {
     return(context.Source.Driver.Builder.Build(context));
 }
Exemplo n.º 14
0
 public UnitOfWork(IDataAccessContext context) {
     _context = context;
 }
Exemplo n.º 15
0
 public UserQuery(IDataAccessContext dataAccessContext)
 {
     _dataAccessContext = dataAccessContext;
 }