Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting defined Entity<long> as multilingual entity blocks creating CreateMultiLingualMap context #6473

Closed
Ilkhom-S opened this issue Jun 16, 2022 · 4 comments · Fixed by #6519
Assignees
Milestone

Comments

@Ilkhom-S
Copy link

Ilkhom-S commented Jun 16, 2022

Hello,
I think there little bug in mutilingual entity.

When I create class like this :

public class ProductTranslation: Entity<long>, IEntityTranslation<Product>

It is blocking for creating configuration.CreateMultiLingualMap<Product, ProductTranslation, ProductDto>(context);

Message:
Error CS0311 The type 'ProductTranslation' cannot be used as type parameter 'TTranslation' in the generic type or method 'AutoMapExtensions.CreateMultiLingualMap<TMultiLingualEntity, TTranslation, TDestination>(IMapperConfigurationExpression, MultiLingualMapContext, bool)'. There is no implicit reference conversion from 'ProductTranslation' to 'Abp.Domain.Entities.IEntity'.

When I set Entity as int everything fine,

I think its because of IEntity<TPrimaryKey> not set in ITranslateEntity.

@sajasbana
Copy link

@Ilkhom-S try like this

public class ProductTranslation: Entity, IEntityTranslation<Product, long>

also

configuration.CreateMultiLingualMap<Product, long, ProductTranslation, ProductDto>(context);

@Ilkhom-S
Copy link
Author

Ilkhom-S commented Jun 16, 2022

@Ilkhom-S try like this

public class ProductTranslation: Entity, IEntityTranslation<Product, long>

also

configuration.CreateMultiLingualMap<Product, long, ProductTranslation, ProductDto>(context);

It doenst help, because IEntityTranslation does not implement TPrimary interface . Error

Error CS0738 'ProductTranslation' does not implement interface member 'IEntityTranslation<Product, long>.CoreId'. 'ProductTranslation.CoreId' cannot implement 'IEntityTranslation<Product, long>.CoreId' because it does not have the matching return type of 'long'.

@Ilkhom-S
Copy link
Author

What I want is to make available to set primary key type for translation Entity. For now ITranslateEntity supports only int hardcoded

@ismcagdas
Copy link
Member

We can allow this for the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants