Localizer in Controller Using using Microsoft.Extensions. Localization; Includes private readonly IStringLocalizer< AppAccessController> _localizer; Resource file must be in a Controller Folder in Resources Method example public Dictionary<string,string> GetRoleList(string appName, bool includeX) { //Code here return allItems.ToDictionary<string, string, string>(i => i, i => _localizer[i] ); }
I am really loving the data entity in my new projects but have come across a couple of issues already. Tonight I learned about using a field that is not a part of your database and not in the entity but is a consolidation field from a group. Once I found some good samples it worked incredibly well and I had a little summary grid on the page in just a couple of minutes. So here is what I did using (myEntityName context = new myEntityName()) { //First I declared a couple of variables because I was looking at data between specific dates DateTime startdate = DateTime.Parse("2014-02-01"); DateTime enddate = DateTime.Parse("2014-02-01"); var dbRecords = (from c in context.myTableName where (c.MemberStartDate >= startdate && c.MemberStart...
I like this method best var customer = db.Customers.Where(d => string.Compare(d.Email,email,true)==0).FirstOrDefault(); It replaces the ToUpper() comparison and is nice and clean
Comments