Example #1
0
        protected override Command CreateInsertCommand(ApplicationLog entity, IAuthenticatedUser user, string selector)
        {
            var command = Query <ApplicationLog>
                          .Single()
                          .Connection(ApplicationLogsConnectionClass.GetConnectionName())
                          .StoredProcedure("[Logs].[pApplicationLog_Insert]")
                          .Parameters(
                p => p.Name("type").Value(entity.Type),
                p => p.Name("userId").Value(entity.UserId),
                p => p.Name("source").Value(entity.Source),
                p => p.Name("message").Value(entity.Message),
                p => p.Name("data").Value(entity.Data),
                p => p.Name("url").Value(entity.Url),
                p => p.Name("stackTrace").Value(entity.StackTrace),
                p => p.Name("hostIpAddress").Value(entity.HostIpAddress),
                p => p.Name("userIpAddress").Value(entity.UserIpAddress),
                p => p.Name("userAgent").Value(entity.UserAgent)
                )
                          .Instance(entity)
                          .MapProperties(
                p => p.Name("Id").Index(0),
                p => p.Name("When").Index(1)
                );

            return(command);
        }
Example #2
0
        public async override Task <ApplicationLog> GetByIdAsync(int?applicationLogId)
        {
            var result = await Query <ApplicationLog>
                         .Single()
                         .Connection(ApplicationLogsConnectionClass.GetConnectionName())
                         .StoredProcedure("[Logs].[pApplicationLog_GetById]")
                         .Parameters(
                p => p.Name("applicationLogId").Value(applicationLogId.Value)
                )
                         .ExecuteAsync();

            return(result.Data);
        }
Example #3
0
        public async override Task <(int, IEnumerable <ApplicationLog>)> GetAsync(CollectionQueryParameters queryParameters)
        {
            var result = await Query <ApplicationLog>
                         .Collection()
                         .Connection(ApplicationLogsConnectionClass.GetConnectionName())
                         .StoredProcedure("[Logs].[pApplicationLog_Get]")
                         .QueryParameters(queryParameters)
                         .Parameters(p => p.Name("count").Size(20).Output())
                         .ExecuteAsync();

            var count = (string)result.GetParameter("count").Value;

            return(int.Parse(count), result.Data);
        }
Example #4
0
        protected override Command CreateDeleteCommand(ApplicationLog entity, IAuthenticatedUser user, string selector)
        {
            switch (selector)
            {
            case "DeleteOlderLogs": return(Command
                                           .NonQuery()
                                           .Connection(ApplicationLogsConnectionClass.GetConnectionName())
                                           .StoredProcedure("[Logs].[pApplicationLog_DeleteOlderLogs]")
                                           .Parameters(
                                               p => p.Name("when").Value(entity.When)
                                               ));

            default: return(Command
                            .NonQuery()
                            .Connection(ApplicationLogsConnectionClass.GetConnectionName())
                            .StoredProcedure("[Logs].[pApplicationLog_Delete]")
                            .Parameters(
                                p => p.Name("applicationLogId").Value(entity.Id)
                                ));
            }
        }
        public GetApplicationLogsQueryAggregate() : base(new DomainFramework.DataAccess.RepositoryContext(ApplicationLogsConnectionClass.GetConnectionName()))
        {
            var context = (DomainFramework.DataAccess.RepositoryContext)RepositoryContext;

            ApplicationLogQueryRepository.Register(context);
        }
Example #6
0
 public CreateApplicationLogCommandAggregate() : base(new DomainFramework.DataAccess.RepositoryContext(ApplicationLogsConnectionClass.GetConnectionName()))
 {
 }
Example #7
0
 public CreateApplicationLogCommandAggregate(CreateApplicationLogInputDto log, EntityDependency[] dependencies = null) : base(new DomainFramework.DataAccess.RepositoryContext(ApplicationLogsConnectionClass.GetConnectionName()))
 {
     Initialize(log, dependencies);
 }