Thank you!
What merge tool do you use? VS defaul?
I noticed that you recently made quite a big change to module-zero-core-template, adding docker support.
I am looking forward to upgrade my application, adding these new changes to it. Usually I do it manually, reading the changelogs and changing file by file. I would like to know if there is a reasonable way of doing it automatically. I thought about pulling the changes from the repo, but the names won't match during the merge, such as AbpCompanyName.AbpProjectName.
Could someone tell me what is the best way of doing it?
Thanks in advance.
If anyone is interested on a quite clean solution:
I create several bundles that adds the localized scripts. Example:
~/Scripts/Localized/en will include ~/Scripts/jquery-validation/js/localization/messages_en.js ~/Scripts/Localized/pt-BR will include ~/Scripts/jquery-validation/js/localization/messages_pt-BR.js
foreach (var cultureName in listLangCultures)
{
bundles.Add(
new ScriptBundle(string.Format("~/Scripts/Localized/{0}", cultureName))
.Include(
string.Format(
"~/Scripts/jquery-validation/js/localization/messages_{0}.js",
cultureName)));
}
The class that renders the localized scripts
public class LocalizedScripts
{
public static HtmlString Render(string fileName, string culture, string delimiter)
{
fileName = string.Concat(fileName, delimiter, culture);
var output = (HtmlString)Scripts.Render(fileName);
return output;
}
public static HtmlString Render(string fileName, string culture)
{
return Render(fileName, culture, "/");
}
public static HtmlString Render(string fileName)
{
return Render(fileName, Thread.CurrentThread.CurrentUICulture.Name, "/");
}
}
Usage examples (used in Layout file, ie)
@LocalizedScripts.Render("~/Scripts/Localized"); // will load ~/Scripts/Localized/[current culture based on thread]
@LocalizedScripts.Render("~/Scripts/Localized", "en"); // will load ~/Scripts/Localized/en
@LocalizedScripts.Render("~/Scripts/Localized", "en", "-"); // will load ~/Scripts/Localized-en
I am not sure if this is the best solution, but it was the easiest/cleanest I could find. It works like a charm. I also suggest implementing something like PermissionNames in the Core layer, but to have a List of all ApplicationLanguage of your application. This way you can also use it on DefaultLanguagesCreator method in DefaultLanguagesCreator
Don't forget the list of language codes: <a class="postlink" href="http://www.science.co.il/Language/Locale-codes.php">http://www.science.co.il/Language/Locale-codes.php</a>
Thanks, hikalkan!
I can't access your link since it is probably private, but I found a workaround. I am loading different localized bundles and then I import the bundle based on the culture name of the user.
Thanks for the answer.
But I can't do it in the bundler, can I? I tried adding like this, but it didn't work!
bundles.Add(
new ScriptBundle("~/Bundles/pages/vendor/js")
.Include("~/Dashboard/assets/plugins/jquery-validation/js/localization/messages_" + Thread.CurrentThread.CurrentUICulture.Name.Replace("-", "_") + ".js")
);
I am working with jqueryvalidation library and it has localization files for each country/language combination. I would like to know the best way to work with bundling of localized files.
Can I inject localization manager inside BundleConfig class and localize the file name there?
Is there a way to access cookies in the Application module? I am trying to create an Attribute capable of verifying a flag in an attribute and can't seem to access Request.Cookies from it.
Thanks in advance
Hey. I am trying to run a bulk insert inside the database. My problem is that I need to us a SqlConnection to do so, inside an AppService. Should I use the Core layer instead?
Anyway, is there a way of accessing th ConnectionString from appsettings.json inside the Web project from another project? Or getting a SqlConnection object from the dbContext or something related?
Thanks in advance
I am trying to generate an email confirmation token, but I am getting the following error:
Exception thrown: 'System.ObjectDisposedException' in mscorlib.dll
var user = await GetCurrentUserAsync();
var token = _userManager.GenerateEmailConfirmationToken(user.Id);
EDIT > I also tried
var user = await GetCurrentUserAsync();
var token = UserManager.GenerateEmailConfirmationToken(user.Id);
Could somebody help me? Thanks in advance.
EDIT> I got it working by setting the provider manually
var provider = new DpapiDataProtectionProvider("AppName");
_userManager.UserTokenProvider = new DataProtectorTokenProvider<User, long>(provider.Create("TokenPurpose")) as IUserTokenProvider<User, long>;
I got it working, if anyone is wondering how, I changed the settings:
Port > 587 Domain > empty string UseDefaultCredentials > false DefaultFromAddress > empty string DefaultFromDisplayName > empty string
I am wondering now how to get a View as a string, so I can build the mail from a View
new MailMessage(new MailAddress("[email protected]"), new MailAddress("[email protected]"))
{
Subject = "test",
Body = [some view here],
IsBodyHtml = true
}