One of the most exciting announcements during this year’s Connect(); event was the ability to embed .NET libraries into existing iOS (Objective-C/Swift) and Android (Java) applications with .NET Embedding. This is great because you can start to share code between your iOS and Android applications, and you can also share the user interface between your apps when you combine .NET Embedding with Xamarin.Forms Native Forms. This means that you can leverage your existing investments and apps without having to re-write them from scratch to start adding cross-platform logic and UI. In fact, during the Connect(); keynote I showed how I was able to extend the open source Swift-based Kickstarter iOS application with .NET Embedding and Xamarin.Forms Native Forms. You can check out the clip below.
Top Issues Fixed in Visual Studio 2019 version 16.2.2
- Fixed Test Explorer doesn't show my tests on VS2019 16.2.0
- Fixed a problem where Visual Studio can stop responding during shutdown.
Security Advisory Notices
CVE-2019-1211 Git for Visual Studio Elevation of Privilege Vulnerability
An elevation of privilege vulnerability exists in Git for Visual Studio when it improperly parses configuration files. An attacker who successfully exploited the vulnerability could execute code in the context of another local user. To exploit the vulnerability, an authenticated attacker would need to modify Git configuration files on a system prior to a full installation of the application. The attacker would then need to convince another user on the system to execute specific Git commands. The update addresses the issue by changing the permissions required to edit configuration files.
using Microsoft.Data.Entity; using Microsoft.Data.Entity.Metadata; using System.Collections.Generic; using System.Linq; namespace UsingEF7WithSQLite { public class Blog { public int BlogId { get; set; } public string Url { get; set; } public List<Post> Posts { get; set; } } public class Post { public int PostId { get; set; } public string Title { get; set; } public string Content { get; set; } public int BlogId { get; set; } public Blog Blog { get; set; } } }
PM> Install-Package EntityFramework.SQLite –Pre
namespace UsingEF7SQLiteProvider { public class BloggingContext : DbContext { public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; } protected override void OnConfiguring(DbContextOptions builder) { builder.UseSQLite(@"Data Source=.\BloggingDatabae.db"); } protected override void OnModelCreating(ModelBuilder builder) { builder.Entity<Blog>() .OneToMany(b => b.Posts, p => p.Blog) .ForeignKey(p => p.BlogId); // The EF7 SQLite provider currently doesn't support generated values // so setting the keys to be generated from developer code builder.Entity<Blog>() .Property(b => b.BlogId) .GenerateValueOnAdd(false); builder.Entity<Post>() .Property(b => b.BlogId) .GenerateValueOnAdd(false); } } }
Install-Package EntityFramework.Commands -Pre
Add-Migration MyFirstMigration Apply-Migration
using (var db = new BloggingContext()) { db.Database.AsMigrationsEnabled().ApplyMigrations(); }
using (var db = new Models.BloggingContext()) { db.Blogs.Add(new Models.Blog { Url = "https://www.dntips.ir" }); db.SaveChanges(); foreach (var item in db.Blogs) { Console.WriteLine(item.Url); } } Console.ReadLine();
In this post, I will describe how to port a desktop application from .NET Framework to .NET Core. I picked a WinForms application as an example. Steps for WPF application are similar and I’ll describe what needs to be done different for WPF as we go. I will also show how you can keep using the WinForms designer in Visual Studio even though it is under development and is not yet available for .NET Core projects.
You want your local web development set up to reflect your production
reality as much as possible. URL parsing, routing, redirects, avoiding
mixed-content warnings, etc. It's very easy to accidentally find oneself
on http:// when everything in 2018 should be under https://.
I'm using ASP.NET Core 2.1 which makes local SSL super easy. After installing from http://dot.net I'll "dotnet new razor" in an empty folder to make a quick web app.