Skip to content

Commit cbbba21

Browse files
committed
updated to EFCore 2.0.1
1 parent 60fc95e commit cbbba21

File tree

165 files changed

+25812
-2521
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+25812
-2521
lines changed
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using Microsoft.EntityFrameworkCore;
1+
using Microsoft.EntityFrameworkCore;
62
using Example.Data.Entities;
73
using FileContextCore.Extensions;
84

@@ -26,6 +22,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
2622
{
2723
//Default: JSON-Serialize
2824
//optionsBuilder.UseFileContext();
25+
optionsBuilder.UseFileContext("xml");
2926

3027
//JSON-Serialize + simple Encryption
3128
//optionsBuilder.UseFileContext(new FileContextCore.Serializer.JSONSerializer(), new FileContextCore.FileManager.EncryptedFileManager());
@@ -37,7 +34,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
3734
//optionsBuilder.UseFileContext(new FileContextCore.Serializer.CSVSerializer());
3835

3936
//Excel
40-
optionsBuilder.UseFileContext(new FileContextCore.CombinedManager.ExcelManager());
37+
//optionsBuilder.UseFileContext(new FileContextCore.CombinedManager.ExcelManager());
4138
}
4239

4340
protected override void OnModelCreating(ModelBuilder modelBuilder)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ namespace Example.Data.Entities
1010
[DataContract]
1111
public class User : Base
1212
{
13+
public User()
14+
{
15+
Test2 = Guid.NewGuid();
16+
}
17+
1318
[DataMember]
1419
public string Username { get; set; }
1520

@@ -20,6 +25,8 @@ public class User : Base
2025
[NotMapped]
2126
public string Ignored { get; set; }
2227

28+
public Guid Test2 { get; set; }
29+
2330
[NotMapped]
2431
public string[] VContents
2532
{

Example/Example.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.1" />
10+
</ItemGroup>
11+
12+
<ItemGroup>
13+
<ProjectReference Include="..\FileContextCore\FileContextCore.csproj" />
14+
</ItemGroup>
15+
16+
</Project>
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
using Example.Data;
22
using Example.Data.Entities;
3-
using Microsoft.EntityFrameworkCore;
4-
using Microsoft.EntityFrameworkCore.Storage;
53
using System;
64
using System.Collections.Generic;
75
using System.Diagnostics;
6+
using Microsoft.EntityFrameworkCore;
87
using System.Linq;
9-
using System.Threading.Tasks;
108

119
namespace Example
1210
{
13-
public class Program
11+
class Program
1412
{
15-
public static void Main(string[] args)
13+
static void Main(string[] args)
1614
{
1715
Context db = new Context();
1816

@@ -22,9 +20,13 @@ public static void Main(string[] args)
2220

2321
watch.Start();
2422

25-
List<User> users2 = db.Users.Include("Contents.Entries").Include("Contents").Include("Settings").ToList();
2623

2724

25+
List<User> users2 = db.Users.Include("Contents.Entries").Include("Contents").Include("Contents").ToList();
26+
27+
//db.Users.RemoveRange(db.Users.Skip(40));
28+
//db.SaveChanges();
29+
2830
List<User> users = db.Users.Include(x => x.Contents).ThenInclude(x => x.Entries).Include(x => x.Settings).ToList(); //db.Users.Include(x => x.Contents).Include(x => x.Settings).ToList();
2931

3032
List<Content> contents = db.Contents.Include(x => x.User).ToList();
@@ -108,7 +110,7 @@ public static void Main(string[] args)
108110
{
109111
string result = Console.ReadLine();
110112

111-
if(result != "q")
113+
if (result != "q")
112114
{
113115
db.Users.Add(new User()
114116
{

0 commit comments

Comments
 (0)