Skip to content

Commit ba01197

Browse files
committed
fixed datacontract and datamember behavior
1 parent d8be911 commit ba01197

File tree

14 files changed

+152
-9
lines changed

14 files changed

+152
-9
lines changed

src/Example/Data/Context.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ public class Context : DbContext
1818

1919
public DbSet<Messurement> Messurements { get; set; }
2020

21+
public DbSet<GenericTest<int>> Generics { get; set; }
22+
2123
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
2224
{
2325
//Default: JSON-Serialize
24-
//optionsBuilder.UseFileContext();
26+
optionsBuilder.UseFileContext();
2527

2628
//JSON-Serialize + simple Encryption
2729
//optionsBuilder.UseFileContext(new FileContextCore.Serializer.JSONSerializer(), new FileContextCore.FileManager.EncryptedFileManager());
@@ -33,7 +35,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
3335
//optionsBuilder.UseFileContext(new FileContextCore.Serializer.CSVSerializer());
3436

3537
//Excel
36-
optionsBuilder.UseFileContext(new FileContextCore.CombinedManager.ExcelManager());
38+
//optionsBuilder.UseFileContext(new FileContextCore.CombinedManager.ExcelManager());
3739
}
3840

3941
protected override void OnModelCreating(ModelBuilder modelBuilder)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Example.Data.Entities
6+
{
7+
public class GenericTest<T> : Base
8+
{
9+
public T Value { get; set; }
10+
11+
}
12+
}

src/Example/Data/Entities/User.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Runtime.Serialization;
45
using System.Threading.Tasks;
56

67
namespace Example.Data.Entities
78
{
9+
[DataContract]
810
public class User : Base
911
{
12+
[DataMember]
1013
public string Username { get; set; }
1114

1215
public string Name { get; set; }

src/Example/Program.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ public static void Main(string[] args)
7878
db.Messurements.Add(current);
7979
db.SaveChanges();
8080

81+
db.Generics.Add(new GenericTest<int>()
82+
{
83+
Value = 1
84+
});
85+
86+
db.Generics.Add(new GenericTest<int>()
87+
{
88+
Value = 2
89+
});
90+
91+
92+
db.SaveChanges();
93+
94+
Console.WriteLine(db.Generics.Count());
95+
8196
while (true)
8297
{
8398
string result = Console.ReadLine();

src/FileContextCore/CombinedManager/ExcelManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
namespace FileContextCore.CombinedManager
1212
{
13+
/// <summary>
14+
/// Used to read and write data of FileContext into Excel-Files (.xlsx)
15+
/// </summary>
1316
public class ExcelManager : ICombinedManager
1417
{
1518
private string password = "";

src/FileContextCore/Extensions/FileContextServiceCollectionExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public static IServiceCollection AddEntityFrameworkFileContext(this IServiceColl
2525
.Singleton<IDatabaseProvider, DatabaseProvider<FileContextProviderServices, FileContextOptionsExtension>>());
2626

2727
services.TryAdd(new ServiceCollection()
28-
//.AddSingleton<FileContextCache>()
2928
.AddSingleton<FileContextModelSource>()
3029
.AddSingleton<FileValueGeneratorCache>()
3130
.AddScoped<FileContextValueGeneratorSelector>()

src/FileContextCore/FileContextCore.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
<RepositoryUrl>https://github.com/morrisjdev/FileContextCore</RepositoryUrl>
2020
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
2121
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
22-
<Version>1.0.7</Version>
22+
<Version>1.0.8</Version>
2323
<PackageTags>ef, database, file, db, filedb, json, xml, csv, xlsx, excel, dbcontext, entity framework</PackageTags>
2424
<PackageIconUrl>https://morrisj.net/img/morrisjdev_logo.png</PackageIconUrl>
2525
</PropertyGroup>
2626

2727
<ItemGroup>
2828
<PackageReference Include="CsvHelper" Version="2.16.3" />
29-
<PackageReference Include="EPPlus.Core" Version="1.3.1" />
29+
<PackageReference Include="EPPlus.Core" Version="1.3.2" />
3030
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.1" />
31-
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
31+
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
3232
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
3333
</ItemGroup>
3434

src/FileContextCore/Helper/QueryHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Microsoft.EntityFrameworkCore.Metadata;
55
using Microsoft.EntityFrameworkCore.Metadata.Internal;
66
using Microsoft.EntityFrameworkCore.Query;
7+
using Microsoft.EntityFrameworkCore.Storage;
78
using System;
89
using System.Collections;
910
using System.Collections.Generic;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
4+
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
5+
-->
6+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
7+
<PropertyGroup>
8+
<PublishProtocol>FileSystem</PublishProtocol>
9+
<Configuration>Release</Configuration>
10+
<TargetFramework>netstandard1.6</TargetFramework>
11+
<PublishDir>bin\Release\PublishOutput</PublishDir>
12+
</PropertyGroup>
13+
</Project>

src/FileContextCore/Query/ExpressionVisitors/FileContextEntityQueryableExpressionVisitor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using Microsoft.EntityFrameworkCore.Metadata.Internal;
2121
using Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal;
2222
using Microsoft.EntityFrameworkCore.Query.Internal;
23+
using Microsoft.EntityFrameworkCore.Storage;
2324

2425
namespace FileContextCore.Query.ExpressionVisitors
2526
{
@@ -28,7 +29,7 @@ class FileContextEntityQueryableExpressionVisitor : EntityQueryableExpressionVis
2829
private EntityQueryModelVisitor queryModelVisitor;
2930
private IQuerySource querySource;
3031

31-
public FileContextEntityQueryableExpressionVisitor(EntityQueryModelVisitor _queryModelVisitor, IQuerySource _querySource) : base(_queryModelVisitor)
32+
public FileContextEntityQueryableExpressionVisitor(EntityQueryModelVisitor _queryModelVisitor, IQuerySource _querySource/*, IModel _model, IMaterializerFactory _materializerFactory*/) : base(_queryModelVisitor)
3233
{
3334
queryModelVisitor = _queryModelVisitor;
3435
querySource = _querySource;

0 commit comments

Comments
 (0)