public async override Task <IEnumerable <SimpleLog> > GetAllAsync()
        {
            var result = await Query <SimpleLog>
                         .Collection()
                         .Connection(SimpleLogsConnectionClass.GetConnectionName())
                         .StoredProcedure("[SimpleLogsBoundedContext].[pSimpleLog_GetAll]")
                         .ExecuteAsync();

            return(result.Records);
        }
        public async override Task <(int, IEnumerable <SimpleLog>)> GetAsync(CollectionQueryParameters queryParameters)
        {
            var result = await Query <SimpleLog>
                         .Collection()
                         .Connection(SimpleLogsConnectionClass.GetConnectionName())
                         .StoredProcedure("[SimpleLogsBoundedContext].[pSimpleLog_Get]")
                         .QueryParameters(queryParameters)
                         .Parameters(p => p.Name("count").Count())
                         .ExecuteAsync();

            return(result.Count, result.Records);
        }
        public async override Task <SimpleLog> GetByIdAsync(int simpleLogId)
        {
            var result = await Query <SimpleLog>
                         .Single()
                         .Connection(SimpleLogsConnectionClass.GetConnectionName())
                         .StoredProcedure("[SimpleLogsBoundedContext].[pSimpleLog_GetById]")
                         .Parameters(
                p => p.Name("simpleLogId").Value(simpleLogId)
                )
                         .ExecuteAsync();

            return(result.Record);
        }
        protected override Command CreateInsertCommand(SimpleLog entity, IAuthenticatedUser user, string selector)
        {
            var command = Query<SimpleLog>
                .Single()
                .Connection(SimpleLogsConnectionClass.GetConnectionName())
                .StoredProcedure("[SimpleLogsBoundedContext].[pSimpleLog_Insert]")
                .Parameters(
                    p => p.Name("messageType").Value(entity.MessageType),
                    p => p.Name("message").Value(entity.Message)
                )
                .RecordInstance(entity)
                .MapProperties(
                    p => p.Name("Id").Index(0),
                    p => p.Name("When").Index(1)
                );

            return command;
        }
        protected override Command CreateDeleteCommand(SimpleLog entity, IAuthenticatedUser user, string selector)
        {
            switch (selector)
            {
                case "DeleteOlderLogs": return Command
                    .NonQuery()
                    .Connection(SimpleLogsConnectionClass.GetConnectionName())
                    .StoredProcedure("[SimpleLogsBoundedContext].[pSimpleLog_DeleteOlderLogs]")
                    .Parameters(
                        p => p.Name("when").Value(entity.When)
                    );

                default: return Command
                    .NonQuery()
                    .Connection(SimpleLogsConnectionClass.GetConnectionName())
                    .StoredProcedure("[SimpleLogsBoundedContext].[pSimpleLog_Delete]")
                    .Parameters(
                        p => p.Name("simpleLogId").Value(entity.Id)
                    );
            }
        }
示例#6
0
 public DeleteOlderLogsCommandAggregate() : base(new DomainFramework.DataAccess.RepositoryContext(SimpleLogsConnectionClass.GetConnectionName()))
 {
 }
示例#7
0
 public DeleteOlderLogsCommandAggregate(DeleteOlderLogsInputDto log, EntityDependency[] dependencies = null) : base(new DomainFramework.DataAccess.RepositoryContext(SimpleLogsConnectionClass.GetConnectionName()))
 {
     Initialize(log, dependencies);
 }
        public GetSimpleLogsQueryAggregate() : base(new DomainFramework.DataAccess.RepositoryContext(SimpleLogsConnectionClass.GetConnectionName()))
        {
            var context = (DomainFramework.DataAccess.RepositoryContext)RepositoryContext;

            SimpleLogQueryRepository.Register(context);
        }