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

Working with LocalizationModelContext #14

Open
inexuscore opened this issue Jun 12, 2016 · 4 comments
Open

Working with LocalizationModelContext #14

inexuscore opened this issue Jun 12, 2016 · 4 comments

Comments

@inexuscore
Copy link

Hi again @damienbod
I'm curious, how would I work with the underlying DbContext in my app?
Suppose I want to seed localization data at Startup (populating the LocalizationRecords table).
Or maybe I want to create a web console in my app, where I can query the records, do CRUD operations etc.

Thanks in advance 🌞

@damienbod
Copy link
Owner

damienbod commented Jun 12, 2016

Hi @inexuscore

Seed should be possible as you have the DbContext in your project. If changes are required to the DbContext itself, then I would use the Localization.SqlLocalizer directly instead of the NuGet package and change it. We could then add this to the package if it helps others.

https://github.com/damienbod/AspNet5Localization/tree/master/AspNet5Localization/src/Localization.SqlLocalizer

Here's the context
https://github.com/damienbod/AspNet5Localization/blob/master/AspNet5Localization/src/Localization.SqlLocalizer/DbStringLocalizer/LocalizationModelContext.cs

Greetings Damien

@inexuscore
Copy link
Author

Hi @damienbod
Great, I think I'll pull in the source to my project and have it as another layer.
The DbContext doesn't require any changes, at least not now, not that I can think of any. But there's only one change I would make: configuring a default value for the UpdatedTimestamp column. That way we'll be able to manually add records in SSMS, Visual Studio or other clients.

Thanks for the repo!

@damienbod
Copy link
Owner

I'll add an interface for the LocalizationModelContext : ILocalizationModelContext
Then you can write your own if required, for example configuring a default value for the UpdatedTimestamp column

@damienbod
Copy link
Owner

interface won't work, need to think of a better solution.

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

No branches or pull requests

2 participants