-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestModel.cs
37 lines (32 loc) · 1.21 KB
/
TestModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System;
namespace ConsoleApplication
{
public class MainContext : DbContext
{
public DbSet<User> Users { get; set; }
public DbSet<Job> Jobs { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(@"Server=tcp:pasta.database.windows.net,1433;Initial Catalog=test;Persist Security Info=False;User ID=pasta;Password=DbTest999;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
}
}
public class User
{
public int Id { get; set; }
[Required] public string Name { get; set; }
[Required] public string Mail { get; set; }
}
public class Job
{
public int Id { get; set; }
[Required] public string Title { get; set; }
[Required] public string Category { get; set; }
[Required] public string Description { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public User CreateUser { get; set; }
}
}