Skip to content

Commit 6065baf

Browse files
committed
#143: Add .NET Core 3.1 console project
1 parent 207e1e4 commit 6065baf

19 files changed

+536
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace SQLite.CodeFirst.NetCore.Console.Entity
2+
{
3+
public class Coach : Person
4+
{
5+
public virtual Team Team { get; set; }
6+
}
7+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
3+
namespace SQLite.CodeFirst.NetCore.Console.Entity
4+
{
5+
public class CustomHistory : IHistory
6+
{
7+
public int Id { get; set; }
8+
public string Hash { get; set; }
9+
public string Context { get; set; }
10+
public DateTime CreateDate { get; set; }
11+
}
12+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System.Collections.Generic;
2+
using System.ComponentModel.DataAnnotations.Schema;
3+
4+
namespace SQLite.CodeFirst.NetCore.Console.Entity
5+
{
6+
/// <summary>
7+
/// See https://github.com/msallin/SQLiteCodeFirst/issues/69 and https://github.com/msallin/SQLiteCodeFirst/issues/63
8+
/// </summary>
9+
public class Foo
10+
{
11+
private ICollection<FooSelf> _fooSelves;
12+
private ICollection<FooStep> _fooSteps;
13+
14+
public int FooId { get; set; }
15+
public string Name { get; set; }
16+
public int? FooSelf1Id { get; set; }
17+
public int? FooSelf2Id { get; set; }
18+
public int? FooSelf3Id { get; set; }
19+
20+
[ForeignKey("FooSelf1Id")]
21+
public virtual Foo ParentMyEntity1 { get; set; }
22+
23+
[ForeignKey("FooSelf2Id")]
24+
public virtual Foo ParentMyEntity2 { get; set; }
25+
26+
[ForeignKey("FooSelf3Id")]
27+
public virtual Foo ParentMyEntity3 { get; set; }
28+
29+
public virtual ICollection<FooStep> FooSteps
30+
{
31+
get { return _fooSteps ?? (_fooSteps = new HashSet<FooStep>()); }
32+
set { _fooSteps = value; }
33+
}
34+
35+
public virtual ICollection<FooSelf> FooSelves
36+
{
37+
get { return _fooSelves ?? (_fooSelves = new HashSet<FooSelf>()); }
38+
set { _fooSelves = value; }
39+
}
40+
}
41+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.Collections.Generic;
2+
using System.ComponentModel.DataAnnotations;
3+
using System.ComponentModel.DataAnnotations.Schema;
4+
5+
namespace SQLite.CodeFirst.NetCore.Console.Entity
6+
{
7+
/// <summary>
8+
/// See https://github.com/msallin/SQLiteCodeFirst/issues/109
9+
/// </summary>
10+
public class FooCompositeKey
11+
{
12+
[Key, Column(Order = 1)]
13+
public int Id { get; set; }
14+
15+
[Key, Column(Order = 2), StringLength(20)]
16+
public string Version { get; set; }
17+
18+
[StringLength(255)]
19+
public string Name { get; set; }
20+
21+
public virtual ICollection<FooRelationshipA> FooeyACollection { get; set; }
22+
23+
public virtual ICollection<FooRelationshipB> FooeyBCollection { get; set; }
24+
}
25+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Collections.Generic;
2+
using System.ComponentModel.DataAnnotations;
3+
4+
namespace SQLite.CodeFirst.NetCore.Console.Entity
5+
{
6+
/// <summary>
7+
/// See https://github.com/msallin/SQLiteCodeFirst/issues/109
8+
/// </summary>
9+
public class FooRelationshipA
10+
{
11+
public int Id { get; set; }
12+
13+
[StringLength(255)]
14+
public string Name { get; set; }
15+
16+
public virtual ICollection<FooCompositeKey> Fooey { get; set; }
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Collections.Generic;
2+
using System.ComponentModel.DataAnnotations;
3+
4+
namespace SQLite.CodeFirst.NetCore.Console.Entity
5+
{
6+
/// <summary>
7+
/// See https://github.com/msallin/SQLiteCodeFirst/issues/109
8+
/// </summary>
9+
public class FooRelationshipB
10+
{
11+
public int Id { get; set; }
12+
13+
[StringLength(255)]
14+
public string Name { get; set; }
15+
16+
public virtual ICollection<FooCompositeKey> Fooey { get; set; }
17+
}
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace SQLite.CodeFirst.NetCore.Console.Entity
2+
{
3+
/// <summary>
4+
/// See https://github.com/msallin/SQLiteCodeFirst/issues/69 and https://github.com/msallin/SQLiteCodeFirst/issues/63
5+
/// </summary>
6+
public class FooSelf
7+
{
8+
public int FooSelfId { get; set; }
9+
public int FooId { get; set; }
10+
public int Number { get; set; }
11+
public virtual Foo Foo { get; set; }
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace SQLite.CodeFirst.NetCore.Console.Entity
2+
{
3+
/// <summary>
4+
/// See https://github.com/msallin/SQLiteCodeFirst/issues/69 and https://github.com/msallin/SQLiteCodeFirst/issues/63
5+
/// </summary>
6+
public class FooStep
7+
{
8+
public int FooStepId { get; set; }
9+
public int FooId { get; set; }
10+
public int Number { get; set; }
11+
public virtual Foo Foo { get; set; }
12+
}
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace SQLite.CodeFirst.NetCore.Console.Entity
2+
{
3+
interface IEntity
4+
{
5+
int Id { get; set; }
6+
}
7+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.ComponentModel.DataAnnotations;
3+
using System.ComponentModel.DataAnnotations.Schema;
4+
5+
namespace SQLite.CodeFirst.NetCore.Console.Entity
6+
{
7+
public abstract class Person : IEntity
8+
{
9+
public int Id { get; set; }
10+
11+
[MaxLength(50)]
12+
[Collate(CollationFunction.NoCase)]
13+
public string FirstName { get; set; }
14+
15+
[MaxLength(50)]
16+
public string LastName { get; set; }
17+
18+
[MaxLength(100)]
19+
public string Street { get; set; }
20+
21+
[Required]
22+
public string City { get; set; }
23+
24+
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
25+
[SqlDefaultValue(DefaultValue = "DATETIME('now')")]
26+
public DateTime CreatedUtc { get; set; }
27+
}
28+
}

0 commit comments

Comments
 (0)