Example #1
0
        protected override Command CreateInsertCommand(TestEntity entity, IAuthenticatedUser user, string selector)
        {
            if (user != null)
            {
                entity.CreatedBy = (int)user.Id;
            }

            var command = Query <TestEntity>
                          .Single()
                          .Connection(SimpleEntityWithAutoGeneratedKeyConnectionClass.GetConnectionName())
                          .StoredProcedure("[SimpleEntityWithAutoGeneratedKeyBoundedContext].[pTestEntity_Insert]")
                          .Parameters(
                p => p.Name("text").Value(entity.Text),
                p => p.Name("enumeration1").Value(entity.Enumeration1),
                p => p.Name("createdBy").Value(entity.CreatedBy),
                p => p.Name("url_Value").Value(entity.Url.Value),
                p => p.Name("typeValue1_DataType").Value(entity.TypeValue1.DataType),
                p => p.Name("typeValue1_Data").Value(entity.TypeValue1.Data),
                p => p.Name("distance_Selected").Value(entity.Distance?.Selected),
                p => p.Name("distance_YesNoNotSure").Value(entity.Distance?.YesNoNotSure),
                p => p.Name("traffic_Selected").Value(entity.Traffic?.Selected),
                p => p.Name("traffic_YesNoNotSure").Value(entity.Traffic?.YesNoNotSure),
                p => p.Name("time_Selected").Value(entity.Time?.Selected),
                p => p.Name("time_YesNoNotSure").Value(entity.Time?.YesNoNotSure)
                )
                          .RecordInstance(entity)
                          .MapProperties(
                p => p.Name("Id").Index(0),
                p => p.Name("IsActive").Index(1)
                );

            return(command);
        }
        public async override Task <IEnumerable <TestEntity> > GetAllAsync()
        {
            var result = await Query <TestEntity>
                         .Collection()
                         .Connection(SimpleEntityWithAutoGeneratedKeyConnectionClass.GetConnectionName())
                         .StoredProcedure("[SimpleEntityWithAutoGeneratedKeyBoundedContext].[pTestEntity_GetAll]")
                         .ExecuteAsync();

            return(result.Records);
        }
Example #3
0
 protected override Command CreateDeleteCommand(TestEntity entity, IAuthenticatedUser user, string selector)
 {
     return(Command
            .NonQuery()
            .Connection(SimpleEntityWithAutoGeneratedKeyConnectionClass.GetConnectionName())
            .StoredProcedure("[SimpleEntityWithAutoGeneratedKeyBoundedContext].[pTestEntity_Delete]")
            .Parameters(
                p => p.Name("testEntityId").Value(entity.Id),
                p => p.Name("userId").Value(user.Id)
                ));
 }
        public async override Task <(int, IEnumerable <TestEntity>)> GetAsync(CollectionQueryParameters queryParameters)
        {
            var result = await Query <TestEntity>
                         .Collection()
                         .Connection(SimpleEntityWithAutoGeneratedKeyConnectionClass.GetConnectionName())
                         .StoredProcedure("[SimpleEntityWithAutoGeneratedKeyBoundedContext].[pTestEntity_Get]")
                         .QueryParameters(queryParameters)
                         .Parameters(p => p.Name("count").Count())
                         .ExecuteAsync();

            return(result.Count, result.Records);
        }
        public async override Task <TestEntity> GetByIdAsync(int testEntityId)
        {
            var result = await Query <TestEntity>
                         .Single()
                         .Connection(SimpleEntityWithAutoGeneratedKeyConnectionClass.GetConnectionName())
                         .StoredProcedure("[SimpleEntityWithAutoGeneratedKeyBoundedContext].[pTestEntity_GetById]")
                         .Parameters(
                p => p.Name("testEntityId").Value(testEntityId)
                )
                         .ExecuteAsync();

            return(result.Record);
        }
Example #6
0
 protected override Command CreateUpdateCommand(TestEntity entity, IAuthenticatedUser user, string selector)
 {
     return(Command
            .NonQuery()
            .Connection(SimpleEntityWithAutoGeneratedKeyConnectionClass.GetConnectionName())
            .StoredProcedure("[SimpleEntityWithAutoGeneratedKeyBoundedContext].[pTestEntity_Update]")
            .Parameters(
                p => p.Name("testEntityId").Value(entity.Id),
                p => p.Name("text").Value(entity.Text),
                p => p.Name("enumeration1").Value(entity.Enumeration1),
                p => p.Name("isActive").Value(entity.IsActive),
                p => p.Name("url_Value").Value(entity.Url.Value),
                p => p.Name("typeValue1_DataType").Value(entity.TypeValue1.DataType),
                p => p.Name("typeValue1_Data").Value(entity.TypeValue1.Data),
                p => p.Name("distance_Selected").Value(entity.Distance?.Selected),
                p => p.Name("distance_YesNoNotSure").Value(entity.Distance?.YesNoNotSure),
                p => p.Name("traffic_Selected").Value(entity.Traffic?.Selected),
                p => p.Name("traffic_YesNoNotSure").Value(entity.Traffic?.YesNoNotSure),
                p => p.Name("time_Selected").Value(entity.Time?.Selected),
                p => p.Name("time_YesNoNotSure").Value(entity.Time?.YesNoNotSure),
                p => p.Name("userId").Value(user.Id)
                ));
 }
Example #7
0
 public SaveTestEntityCommandAggregate() : base(new DomainFramework.DataAccess.RepositoryContext(SimpleEntityWithAutoGeneratedKeyConnectionClass.GetConnectionName()))
 {
 }
Example #8
0
 public SaveTestEntityCommandAggregate(SaveTestEntityInputDto entity, EntityDependency[] dependencies = null) : base(new DomainFramework.DataAccess.RepositoryContext(SimpleEntityWithAutoGeneratedKeyConnectionClass.GetConnectionName()))
 {
     Initialize(entity, dependencies);
 }