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

Is it possible to use translations for navigation properties? #2

Closed
AlexKeySmith opened this issue Aug 13, 2012 · 3 comments
Closed

Comments

@AlexKeySmith
Copy link

Hi,
Is it possible to use translations for navigation properties?

I'm using foreign keys in dbcontext, and have succesfully overriden the FK value via an expression. But I cannot think of a way of overriding the actual navigation?

-thanks
Alex.

@damieng
Copy link
Owner

damieng commented Aug 24, 2012

I can't see how this would work - what would you expect to be able to do? I'm having a problem trying to imagine a scenario.

@davidfowl
Copy link
Collaborator

+1, I'm not sure why you'd want to overwrite a navigation property.

@AlexKeySmith
Copy link
Author

Good question damieng! It is a pretty odd request :-)

We've found Linq.Translations to be a nice retro-fit for customising the properties of an entity in a multi-tenant system.

The possible purpose of customising a navigation property is to allow the tenant to change a relationship.

For example a tenant is allowed to customise the title of a "course", but they also need to be able to customise "approval type" relationship (e.g. approved by a line manager, approved by the head of the business etc)

Unfortunately changing the foreign key wasn't enough to trick EF into switching it.

The linq expression does a join to a customisations table (based upon the logged in user), if a customisation is found it switches the original values for the customised values. It's working pretty well and we've got a workaround for the navigation properties, but I wondered if there was a way to get the navigation properties to work to.

@damieng damieng closed this as completed Oct 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants