This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE PROCEDURE [dbo].[UpdateChildItems] | |
| @ParentItemId INT, | |
| @ChildItems ChildItemsType READONLY | |
| AS | |
| BEGIN | |
| MERGE ChildItems AS t | |
| USING (SELECT Id, ParentItemId, SomeProperty1, SomeProperty2, SomeProperty3 FROM @ChildItems) AS s | |
| ON t.Id = s.Id AND t.ParentItemId = s.ParentItemId | |
| WHEN MATCHED THEN | |
| UPDATE SET t.SomeProperty1 = s.SomeProperty1, t.SomeProperty2 = s.SomeProperty2, t.SomeProperty3 = s.SomeProperty3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TYPE [dbo].[ChildItemsType] AS TABLE( | |
| [Id] [int] NOT NULL, | |
| [ParentItemId] [int] NOT NULL, | |
| [SomeProperty1] [nvarchar](64) NOT NULL, | |
| [SomeProperty2] [nvarchar](64) NOT NULL, | |
| [SomeProperty3] [nvarchar](64) NOT NULL | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void Merge(int parentItemId, IEnumerable<ChildItem> childItems) | |
| { | |
| using (IDbConnection db = this.CreateDbConnection()) | |
| db.Execute( | |
| "UpdateChildItems", | |
| new { ParentItemId = parentItemId, ChildItems = childItems.ToDataTable("ParentItem") }, | |
| commandType: CommandType.StoredProcedure | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ChildItem childItem1 = new ChildItem(); | |
| childItem1.ParentItemId = parentItem.Id; | |
| childItem1.SomeProperty1 = "Aaa1_1"; | |
| childItem1.SomeProperty2 = "Aaa1_2"; | |
| childItem1.SomeProperty3 = "Aaa1_3"; | |
| ChildItem childItem2 = new ChildItem(); | |
| childItem2.ParentItemId = parentItem.Id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this.unitOfWork.CatRepository.GetAdults(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this.dbContext.Cats.Where(c => c.Age >= 3 && c.Age <= 7).OrderBy(c => c.Name); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <link href="//cdn.flexir.io/stable/flexir.min.css" rel="stylesheet" /> | |
| </head> | |
| <body> | |
| <div id="flexir"></div> | |
| <script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-1.11.3.min.js"></script> | |
| <script src="//cdn.flexir.io/stable/flexir.min.js"></script> | |
| <script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void Configure(IApplicationBuilder applicationBuilder) | |
| { | |
| RequestLocalizationOptions requestLocalizationOptions = new RequestLocalizationOptions(); | |
| requestLocalizationOptions.SupportedCultures = requestLocalizationOptions.SupportedUICultures = | |
| new CultureInfo[] { new CultureInfo("en"), new CultureInfo("ru"), new CultureInfo("uk") }.ToList(); | |
| requestLocalizationOptions.RequestCultureProviders.Insert(0, new RouteValueRequestCultureProvider() { Options = requestLocalizationOptions }); | |
| applicationBuilder.UseRequestLocalization(requestLocalizationOptions); | |
| applicationBuilder.UseMvc(configureRoutes => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class RouteValueRequestCultureProvider : RequestCultureProvider | |
| { | |
| public override Task<ProviderCultureResult> DetermineProviderCultureResult(HttpContext httpContext) | |
| { | |
| string cultureCode = null; | |
| if (httpContext.Request.Path.HasValue && httpContext.Request.Path.Value == "/") | |
| cultureCode = this.GetDefaultCultureCode(); | |
| // TODO: make it look more beautiful |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IEnumerable<Category> categories = this.cache.GetWithDefaultValue<IEnumerable<Category>>( | |
| "categories", () => this.storage.Categories.ToList() | |
| ); |