This file contains 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
using Microsoft.EntityFrameworkCore; | |
namespace TvpSampleApp | |
{ | |
public class MyContext : DbContext | |
{ | |
public DbSet<Person> People { get; set; } | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |
{ |
This file contains 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
using System.Data.Entity; | |
using System.Data.Entity.Infrastructure; | |
namespace MyApplication | |
{ | |
public class MyDbConfiguration : DbConfiguration | |
{ | |
public MyDbConfiguration() : base() | |
{ | |
this.SetModelStore(new DefaultDbModelStore(Directory.GetCurrentDirectory())); |
This file contains 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
using System; | |
using System.Data.Entity; | |
namespace MyApplication | |
public class MyContext: DbContext | |
{ | |
public DbSet<Person> People { get; set; } | |
protected override void OnModelCreating(DbModelBuilder modelBuilder) | |
{ |
This file contains 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
var query = db.People.Where(p => DbFunctions.Like(p.Name, "w%")); |
This file contains 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
System.Data.Entity.SqlServer.SqlProviderServices.UseScopeIdentity = false; |
This file contains 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
using Microsoft.EntityFrameworkCore; | |
using System.Linq; | |
namespace ConsoleApp33 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using (var context = new MyContext()) |
This file contains 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
using System; | |
using System.Linq; | |
using Microsoft.Data.Sqlite; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace EnsureCreatedSqliteInMemory | |
{ | |
class Program | |
{ |
This file contains 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
using System; | |
using System.Linq; | |
namespace SortWithJoin | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var keys = new [] { 5, 7, 3, 2, 1, 4, 6, 9, 8 }; |
This file contains 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
// What's new in C# | |
// Good places to start: | |
// - https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-version-history#c-version-72 | |
// - https://docs.microsoft.com/dotnet/csharp/whats-new/csharp-11 | |
#region implicit and global usings (C# 10) | |
global using Microsoft.EntityFrameworkCore; | |
global using System.Collections; | |
using System; | |
#endregion |