mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
20 lines
557 B
C#
20 lines
557 B
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace SqlServerEFSample
|
|
{
|
|
public class EFSampleContext : DbContext
|
|
{
|
|
string _connectionString;
|
|
public EFSampleContext(string connectionString)
|
|
{
|
|
this._connectionString = connectionString;
|
|
}
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
optionsBuilder.UseSqlServer(this._connectionString);
|
|
}
|
|
|
|
public DbSet<User> Users { get; set; }
|
|
public DbSet<Task> Tasks { get; set; }
|
|
}
|
|
} |