Microsoft’s new cross platform frameworks - .NET Core, ASP.NET Core and Entity Framework Core - have been presented briefly along with Microsoft’s conventional technologies in this slide deck.
10. A referendum
A vote in which everyone of voting age can take part
was held on Thursday 23 June,
to decide whether the UK should leave or remain in the European Union.
24. ASP.NET Core Demo - Identity
Inject following class by building DI
UserManager<ApplicationUser> _userManager;
SignInManager<ApplicationUser> _signInManager;
Use following methods
_userManager.CreateAsync
_signInManager.SignInAsync
_signInManager.PasswordSignInAsync
_signInManager.SignOutAsync
25. EF Core Demo
Install EF core from NuGet
Create a new class and inherit it from DBContext Class
Over write method OnConfiguring
Builder.UseSqlServer(“ConectionString”);
Point out POCO model
DbSet<Blog> Blogs { get; set; }
PM> Install-Package Microsoft.EntityFrameworkCore.SqlServer
26. EF Core Demo
Define Blog class
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
public List<Post> Posts { get; set; }
}
27. EF Core Demo
Query
using (var db = new BloggingContext())
{
var blogs = db.Blogs
.Where(b => b.Rating > 3)
.OrderBy(b => b.Url)
.ToList();
}
28. EF Core Demo
Save
using (var db = new BloggingContext())
{
var blog = new Blog { Url = "http://sample.com" };
db.Blogs.Add(blog);
db.SaveChanges();
}