예제 #1
0
        public void Configuration(IAppBuilder app)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString;

            var userNameQuery = new SimppleTokenUserNameQuery();
            var envelop = new EnvelopWithUserName(userNameQuery);

            var getAllDocumentsQuery = new GetAllDocumentsSqlQuery(connectionString)
                                    .Secured();
            var getDocumentQuery = new GetDocumentSqlQuery(connectionString)
                                    .Secured();

            var submitDocCmd = new SubmitNewDocumentSqlCommand(connectionString)
                                    .WithDocumentValidation()
                                    .Secured()
                                    .Transacted();
            var updateDocCmd = new UpdateDocumentSqlCommand(connectionString)
                                    .WithLockValidation(getDocumentQuery)
                                    .WithDocumentValidation()
                                    .Secured()
                                    .Transacted();
            var putLockCmd = new PutLockOnDocumentSqlCommand(connectionString)
                                    .WithLockValidation(getDocumentQuery)
                                    .Secured()
                                    .Transacted();
            var removeLockCmd = new RemoveLockFromDocumentSqlCommand(connectionString)
                                    .WithLockValidation(getDocumentQuery)
                                    .Secured()
                                    .Transacted();
            var deleteDocCmd = new DeleteDocumentSqlCommand(connectionString)
                                    .WithLockValidation(getDocumentQuery)
                                    .Secured()
                                    .Transacted();

            var config = new HttpConfiguration();
            var compositon = new CompositionRoot(
                                    envelop,
                                    getAllDocumentsQuery,
                                    getDocumentQuery,
                                    submitDocCmd,
                                    updateDocCmd,
                                    putLockCmd,
                                    removeLockCmd,
                                    deleteDocCmd);

            HttpConfigurator.Configure(config, compositon);
            app.UseCors(CorsOptions.AllowAll);
            app.UseWebApi(config);
        }
예제 #2
0
        public void Configuration(IAppBuilder app)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString;

            var userNameQuery = new SimppleTokenUserNameQuery();
            var envelop = new EnvelopWithUserName(userNameQuery);

            var allTicketsQuery = new GetAllTicketsSqlQuery(connectionString)
                                    .Secured();
            var getTicketQuery = new GetTicketByIdQuerySqlQuery(connectionString)
                                    .Secured();
            var getVersionQuery = new IfMatchHttpHeaderTicketVersionQuery();

            var addTicketCmd = new SubmitNewTicketSqlCommand(connectionString)
                                    .WithTicketValidation()
                                    .Secured()
                                    .Transacted();
            var updateTicketCmd = new UpdateTicketSqlCommand(connectionString)
                                    .WithTicketValidation()
                                    .Secured()
                                    .Transacted();
            var deleteTicketCmd = new DeleteTicketSqlCommand(connectionString)
                                    .Secured()
                                    .Transacted();

            var compositon = new CompositionRoot(
                envelop,
                userNameQuery,
                allTicketsQuery,
                getTicketQuery,
                getVersionQuery,
                addTicketCmd,
                updateTicketCmd,
                deleteTicketCmd);

            var config = new HttpConfiguration();
            HttpConfigurator.Configure(config, compositon);

            app.UseCors(CorsOptions.AllowAll);
            app.UseWebApi(config);
        }