I have extended the DataBaseBlobContainer class with a new field a foreign key. In my service I want to create query which used the extended property but I cant it access after I get the IQueryable.
IQueryable<DatabaseBlobContainer> queryable = (await _databaseBlobContainerRepository.GetQueryableAsync())
.. here I want to use it
how can I do this ?
Finally I found the solution
.ForMember(dest => dest.ExtraProperties, opt => opt.MapFrom(r => new Dictionary<string, object>() { { "Category", r.Category }, .... and so on))
Maybe this will help others. Thank you maliming for your help.
How can I select the extensions properties from the DatabaseBlob in the mapper ? I always got a exception I tried to acces the properties like this
.ForPath(dest => dest.ExtraProperties["Category"], opt => opt.MapFrom(src => src.Category))
Hi same error again. I also have created the constructor.
DatabaseBlob -> BlobDto (Destination member list) Volo.Abp.BlobStoring.Database.DatabaseBlob -> IT42Portal.AssetManagement.Blob.BlobDto (Destination member list)
BlobDto -> DatabaseBlob (Source member list) IT42Portal.AssetManagement.Blob.BlobDto -> Volo.Abp.BlobStoring.Database.DatabaseBlob (Source member list)
DatabaseBlob -> CreateBlobDto (Destination member list) Volo.Abp.BlobStoring.Database.DatabaseBlob -> IT42Portal.AssetManagement.Blob.CreateBlobDto (Destination member list)
Done you should received the inivite
I have sent it as 7zip but it was blocked. How should I sent it to you ?
I have sent it to you.
Hi maliming,
thank you for checking. In the meantime I have tried to use another template where all packages have the same version (5.3.4). I got the same error.
1[[Volo.Abp.TenantManagement.AbpTenantManagementDomainModule, Volo.Abp.TenantManagement.Domain, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null]] -> Volo.Abp.AutoMapper.AutoMapperAutoObjectMappingProvider
1[[Volo.Abp.TenantManagement.AbpTenantManagementDomainModule, Volo.Abp.TenantManagement.Domain, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null]] -> λ:Volo.Abp.AutoMapper.IMapperAccessor -> λ:Volo.Abp.AutoMapper.MapperAccessor.
---> AutoMapper.AutoMapperConfigurationException:
Unmapped members were found. Review the types and members below.
Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type
For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters
======================================================================================
DatabaseBlob -> BlobDto (Destination member list)
Volo.Abp.BlobStoring.Database.DatabaseBlob -> IT42Portal.AssetManagement.Blob.BlobDto (Destination member list)Unmapped properties: Category
Hi, I have downloaded a module template with abp suite. Then I have created a UnifiedEfCoreEntityExtensionMappings.cs in the xxx.Web.Unified Module. This Class contains the code for the extension
public static void Configure()
{
OneTimeRunner.Run(() =>
{
ObjectExtensionManager.Instance
.MapEfCoreProperty<DatabaseBlob, bool>("AdditionalProperty");
more extensions .....
});
}
I call this method in the UnifieddbContextFactory.cs.
public UnifiedDbContext CreateDbContext(string[] args)
{
UnifiedEfCoreEntityExtensionMappings.Configure(); // HERE
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<UnifiedDbContext>()
.UseSqlServer(configuration.GetConnectionString("Default"));
return new UnifiedDbContext(builder.Options);
}
The migrations is created and the extensions are done in the database. But when I create the mappings I always got the above mentioned exception.
May mappings are done in the xxx.Application.Module and looks like this
CreateMap<DatabaseBlob, BlobDto>()
.MapExtraProperties(MappingPropertyDefinitionChecks.None, null, true)
.ReverseMap();
... more mappings they look identical
What should I do that the mapping works ?
thank you for your help
I recreated the whole project and now it works. thank you for you help