jgauffin / griffin.mvccontrib

A contribution project for ASP.NET MVC3
http://blog.gauffin.org/tag/griffin-mvccontrib/
GNU Lesser General Public License v3.0
83 stars 40 forks source link

RavenDB localization provider setup #27

Closed brgrz closed 11 years ago

brgrz commented 11 years ago

Hey Jonas, great work overall. But where are the docs for RavenDB? I cannot find them in Griffin.Mvc.Docs or in wiki. In CodeProject article you say: "I've chosen SqlServer as the data source in this article. The wiki at github shows how to use the other sources." But there is no RavenDB wiki article. Or is it?

jgauffin commented 11 years ago

https://github.com/jgauffin/griffin.mvccontrib/wiki <-- Look at the bottom.

Is that enough or do you want more?

brgrz commented 11 years ago

Thanks, what's needed to be inserted instead of this?

// Connection factory used by the SQL providers. builder.RegisterInstance(new AdoNetConnectionFactory("DemoDb")).AsSelf(); builder.RegisterType().AsImplementedInterfaces().InstancePerLifetimeScope();

// and the repositories builder.RegisterType().AsImplementedInterfaces().InstancePerLifetimeScope(); builder.RegisterType().AsImplementedInterfaces().InstancePerLifetimeScope();

brgrz commented 11 years ago

I've found the repositories, for the "and the repositories" section, are these ones ok?

Griffin.MvcContrib.RavenDb.Localization.TypeLocalizationRepository Griffin.MvcContrib.RavenDb.Localization.ViewLocalizationRepository

What about the connection factory part for RavenDB?

jgauffin commented 11 years ago

they just need a IDocumentSession from Raven

On Thu, Nov 15, 2012 at 12:42 PM, Marko notifications@github.com wrote:

I've found the repositories, for the "and the repositories" section, are these ones ok?

Griffin.MvcContrib.RavenDb.Localization.TypeLocalizationRepository Griffin.MvcContrib.RavenDb.Localization.ViewLocalizationRepository

What about the connection factory part for RavenDB?

— Reply to this email directly or view it on GitHubhttps://github.com/jgauffin/griffin.mvccontrib/issues/27#issuecomment-10405858.

brgrz commented 11 years ago

All right, I think I got it working, it created a TypeLocalization/en-us document in RavenDB, is this it? It seems to only contain the attribute localizations.

Also is there a way to autoimport the values from .resx into the database (the first time)?

jgauffin commented 11 years ago

that's all type localizations.

The view localizations will be stored in a ViewLocalization document.

On Thu, Nov 15, 2012 at 1:34 PM, Marko notifications@github.com wrote:

All right, I think I got it working, it created a TypeLocalization/en-us document in RavenDB, is this it? It seems to only contain the attribute localizations.

Also is there a way to autoimport the values from .resx into the database (the first time)?

— Reply to this email directly or view it on GitHubhttps://github.com/jgauffin/griffin.mvccontrib/issues/27#issuecomment-10407083.

brgrz commented 11 years ago

Why is it overwritting my en-US changes? I changed the text for Required attribute in RavenDB studio, saved (which was successful), refreshed my site and the changes in RavenDB were reset.

brgrz commented 11 years ago

Oh, I see, it makes a copy of the strings from DB at runtime and keeps them around, which I guess is fine, the problem is it also writes them back to the datastore on refresh. I think that's wrong both from the logical perspective and the Single Responsibility Principle. Refreshing the site should never have a side effect of a write operation happening under the hood (unless it's some logging or similar feature which in this case is not).

?

jgauffin commented 11 years ago

It's how it detects missing texts.

However it should never overwrite existing texts.

On Thu, Nov 15, 2012 at 2:46 PM, Marko notifications@github.com wrote:

Oh, I see, it makes a copy of the strings from DB at runtime and keeps them around, which I guess is fine, the problem is it also writes them back to the datastore on refresh. I think that's wrong both from the logical perspective and the Single Responsibility Principle. Refreshing the site should never have a side effect of a write operation happening under the hood (unless it's some logging or similar feature which in this case is not).

?

— Reply to this email directly or view it on GitHubhttps://github.com/jgauffin/griffin.mvccontrib/issues/27#issuecomment-10408881.

jgauffin commented 11 years ago

feel free to create a pull request. the code isn't very complex

On Thu, Nov 15, 2012 at 2:48 PM, Jonas Gauffin jonas@gauffin.org wrote:

It's how it detects missing texts.

However it should never overwrite existing texts.

On Thu, Nov 15, 2012 at 2:46 PM, Marko notifications@github.com wrote:

Oh, I see, it makes a copy of the strings from DB at runtime and keeps them around, which I guess is fine, the problem is it also writes them back to the datastore on refresh. I think that's wrong both from the logical perspective and the Single Responsibility Principle. Refreshing the site should never have a side effect of a write operation happening under the hood (unless it's some logging or similar feature which in this case is not).

?

— Reply to this email directly or view it on GitHubhttps://github.com/jgauffin/griffin.mvccontrib/issues/27#issuecomment-10408881.

brgrz commented 11 years ago

I opened another issue on this. I could change it but let's discuss it first.

brgrz commented 11 years ago

omg another solution using NuGet package restore...this makes projects a pain to add to my solution and debug...https://github.com/davidfowl/NuGetPowerTools/issues/19