Giter Club home page Giter Club logo

filecontextcore's People

Contributors

dini001 avatar heedfull avatar j13leach avatar kuraiandras avatar morrisjdev avatar n-junge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

filecontextcore's Issues

Exception when saving a byte array

Hi,
I get an exception everytime I use "context.SaveChanges()" on an object containing an byte array.
I have modified your dotnetfiddle to show this.
Exception:

Unhandled exception. System.InvalidCastException: Unable to cast object of type 'System.Byte[]' to type 'System.Object[]'.
   at FileContextCore.Serializer.SerializerHelper.Serialize(Object input)
   at FileContextCore.Serializer.JSONSerializer`1.Serialize[TKey](Dictionary`2 list)
   at FileContextCore.Storage.Internal.FileContextTable`1.<Init>b__22_0(Dictionary`2 list)
   at FileContextCore.Storage.Internal.FileContextTable`1.Save()
   at FileContextCore.Storage.Internal.FileContextStore.ExecuteTransaction(IEnumerable`1 entries, IDiagnosticsLogger`1 updateLogger)
   at FileContextCore.Storage.Internal.FileContextDatabase.SaveChanges(IReadOnlyList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()
   at Program.Main()

Custom ISerializer - binary file

Hello,

I was wondering if you might consider opening the ISerializer interface and allowing UseFileContextDatabase() to accept a custom ISerializer. My specific aim is to use a custom binary serializer so I can use a binary file as my database. My DbContext would have DbSets of classes that have been written using StructLayout annotations.

Cascade Support

Thanks for creating this library which is great for demos and using this in IdentityManagerUI repo. Do you have any plans to support Cascade Delete? This causes issues since if a role in AspNetRoles is deleted then corresponding record in AspNetUserRoles is orphaned.

Exception in EXCELStoreManager

I am following the introduction of the Entity Framework Introduction here: https://docs.microsoft.com/en-us/ef/core/get-started/?tabs=netcore-cli . The project works fine when using JSONStoreManager. If however I change the line

protected override void OnConfiguring(DbContextOptionsBuilder options)
    => options.UseFileContextDatabase();

to

protected override void OnConfiguring(DbContextOptionsBuilder options)
    => options.UseFileContextDatabase<EXCELStoreManager>();

then I receive the following Exception

Unhandled exception. System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory
   at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
   at System.Drawing.SafeNativeMethods.Gdip..cctor()
   --- End of inner exception stack trace ---
   at System.Drawing.SafeNativeMethods.Gdip.GdipGetGenericFontFamilySansSerif(IntPtr& fontfamily)
   at System.Drawing.FontFamily.GetGdipGenericSansSerif()
   at System.Drawing.FontFamily.get_GenericSansSerif()
   at System.Drawing.Font.CreateFont(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte charSet, Boolean isVertical)
   at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
   at OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double MinimumWidth, Double MaximumWidth)
   at OfficeOpenXml.ExcelRangeBase.AutoFitColumns(Double MinimumWidth)
   at OfficeOpenXml.ExcelRangeBase.AutoFitColumns()
   at OfficeOpenXml.ExcelColumn.AutoFit()
   at FileContextCore.StoreManager.EXCELStoreManager.Initialize(IFileContextScopedOptions options, IEntityType entityType, Object keyValueFactory)
   at FileContextCore.Storage.Internal.FileContextTable`1.Init()
   at FileContextCore.Storage.Internal.FileContextTable`1..ctor(IPrincipalKeyValueFactory`1 keyValueFactory, Boolean sensitiveLoggingEnabled, IEntityType entityType, IFileContextScopedOptions options, IServiceProvider serviceProvider)
   at FileContextCore.Storage.Internal.FileContextTableFactory.<>c__DisplayClass7_0`1.<CreateFactory>b__0()
   at FileContextCore.Storage.Internal.FileContextTableFactory.Create(IEntityType entityType)
   at FileContextCore.Storage.Internal.FileContextStore.EnsureTable(Object key, IEntityType entityType)
   at FileContextCore.Storage.Internal.FileContextStore.GetIntegerValueGenerator[TProperty](IProperty property)
   at FileContextCore.ValueGeneration.Internal.FileContextValueGeneratorSelector.GetOrCreate(IProperty property)
   at FileContextCore.ValueGeneration.Internal.FileContextValueGeneratorSelector.Select(IProperty property, IEntityType entityType)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.ValueGenerationManager.Generate(InternalEntityEntry entry)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState entityState, Boolean acceptChanges, Boolean modifyProperties, Nullable`1 forceStateWhenUnknownKey)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.PaintAction(EntityEntryGraphNode`1 node)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode`1 node, Func`2 handleNode)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityGraphAttacher.AttachGraph(InternalEntityEntry rootEntry, EntityState targetState, EntityState storeGeneratedWithKeySetTargetState, Boolean forceStateWhenUnknownKey)
   at Microsoft.EntityFrameworkCore.DbContext.SetEntityState(InternalEntityEntry entry, EntityState entityState)
   at Microsoft.EntityFrameworkCore.DbContext.SetEntityState[TEntity](TEntity entity, EntityState entityState)
   at Microsoft.EntityFrameworkCore.DbContext.Add[TEntity](TEntity entity)
   at dotnet_dev.Program.Main() in /home/benj/clients/agentjs/src/backend/dotnet-dev/Program.cs:line 14

Environment

$ dotnet --version
3.1.302

$ uname -a
Linux 5.4.52-1-lts #1 SMP Thu, 16 Jul 2020 19:35:06 +0000 x86_64 GNU/Linux

Entity framework 6 Support

This framework is not supporting EF6
but I would like to share my working version of it
I was able to clone the code and upgrade it to EF6 and I tested it without any issue.

No support for .Net 6

I'm using this library for some test projects. This works fine as long as the target framework is .Net 5 or lower. Setting it to .Net 6 will break some queries.

  Message: 
System.TypeInitializationException : The type initializer for 'Microsoft.EntityFrameworkCore.EnumerableMethods' threw an exception.
  ----> System.InvalidOperationException : Sequence contains more than one matching element

  Stack Trace: 
EnumerableMethods.get_AnyWithPredicate()
AllAnyToContainsRewritingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
MethodCallExpression.Accept(ExpressionVisitor visitor)
ExpressionVisitor.Visit(Expression node)
QueryTranslationPreprocessor.Process(Expression query)
QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
Database.CompileQuery[TResult](Expression query, Boolean async)
QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
<>c__DisplayClass9_0`1.<Execute>b__0()
CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
<17 more frames...>
ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
ContextUtils.DoIsolated(ContextCallback callback, Object state)
ContextUtils.DoIsolated[T](Func`1 func)
SimpleWorkItem.PerformWork()
--InvalidOperationException
ThrowHelper.ThrowMoreThanOneMatchException()
Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
EnumerableMethods.cctor()

I managed to get it to work by updating this library to use .Net 6 as well.

An update to EFCore6 does not seem required.

IndexOutOfRangeException when using inheritance

Great job!

Does this library support inheritance? When I use inheritance I get an IndexOutOfRangeException.

Details:

      An unhandled exception has occurred while executing the request.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at FileContextCore.Storage.Internal.FileContextTable`1.<>c__DisplayClass29_0.<ApplyValueConverter>b__1(Object value, Int32 index)
   at System.Linq.Enumerable.SelectIterator[TSource,TResult](IEnumerable`1 source, Func`3 selector)+MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at FileContextCore.Storage.Internal.FileContextTable`1.ApplyValueConverter(Dictionary`2 list, Func`2 conversionFunc)
   at FileContextCore.Storage.Internal.FileContextTable`1.ConvertToProvider(Dictionary`2 list)
   at FileContextCore.Storage.Internal.FileContextTable`1.<Init>b__27_0(Dictionary`2 list)
   at FileContextCore.Storage.Internal.FileContextTable`1.Save()
   at FileContextCore.Storage.Internal.FileContextStore.ExecuteTransaction(IList`1 entries, IDiagnosticsLogger`1 updateLogger)
   at FileContextCore.Storage.Internal.FileContextDatabase.SaveChangesAsync(IList`1 entries, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(DbContext _, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Todo.ServiceLayer.ActionController.Post(Action entity) in 
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)```

Excel: Read properties from column with corresponding header

I'm using FileContextCore to read existing Excel files and perform actions on those.
Currently the Excel deserializer always assumes that the columns are ordered alphabetically with the primary key in the first column. This might, however, not always be the case.

The Excel (de-)serializer should match the properties with the Excel column header. I append my solution to this as pull request.

Does not work with EF Core 5.0.0

I Just updated my project from .NET Core 3.1 to .NET 5.0. While updating, I also updated EF Core packages (3.1.7 -> 5.0.0). After updating, I get the following error:

System.TypeLoadException: Method 'CommitTransactionAsync' in type 'FileContextCore.Storage.Internal.FileContextTransactionManager' from assembly 'FileContextCore, Version=3.4.0.0, Culture=neutral, PublicKeyToken=165cac099da39c78' does not have an implementation.
   at Microsoft.Extensions.DependencyInjection.FileContextServiceCollectionExtensions.AddEntityFrameworkFileContextDatabase(IServiceCollection serviceCollection)
   at FileContextCore.Infrastructure.Internal.FileContextOptionsExtension.ApplyServices(IServiceCollection services)
   at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.ApplyServices(IDbContextOptions options, ServiceCollection services)
   at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<>c__DisplayClass4_0.<GetOrAdd>g__BuildServiceProvider|3()
   at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<>c__DisplayClass4_0.<GetOrAdd>b__2(Int64 k)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, Boolean providerRequired)
   at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
   at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
   at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Internal.IDbContextDependencies.get_EntityFinderFactory()
   at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.get_Finder()
   at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.FindAsync(Object[] keyValues)
   at Recipes.Infrastructure.Repositories.CategoryRepository.GetCategoryAsync(Int32 categoryId) in C:\workspace\private\recipe-printer\Recipes.Infrastructure\Repositories\CategoryRepository.cs:line 25
   at Recipes.Application.Commands.SaveCategoryCommandHandler.HandleAsync(SaveCategoryCommand command) in C:\workspace\private\recipe-printer\Recipes.Application\Commands\SaveCategoryCommandHandler.cs:line 23
   at Recipes.Api.Controllers.CategoriesController.Save(SaveCategoryCommand command) in C:\workspace\private\recipe-printer\Recipes.Api\Controllers\CategoriesController.cs:line 48
   at lambda_method17(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

If I downgrade Microsoft.EntityFrameworkCore.Design to 3.1.7, the error goes away.

DbContext Dispose not works

After disposing of the first context, the second contains the same data.

Example:

using (var context = new Context())
{
    context.Users.Add(new User());
    context.SaveChanges();
}

Directory.Delete(Path.Combine(AppContext.BaseDirectory, "appdata"), true);

using (var context = new Context())
{
    var u1 = context.Users.First();
}

I expected exception here

EF scaffolding

Have you considered supporting scaffolding (aka reverse-engineering)?

It would be cool to be able to run

dotnet ef dbcontext scaffold "Data Source=file.xls" FileContextCore

and get a DbContext and the entity classes for the file so it can be accessed with LINQ-to-Entites

NullReferenceException with custom ISerializer

I am trying to implement a custom ISerializer (CustomSerializer class) to accommodate a different format of the JSON file on disk. I added the following code to my ConfigureServices method to attempt to register my custom serializer.

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddDbContext<Context>(options => 
                options.UseFileContextDatabase<CustomSerializer,DefaultFileManager>(location:"C:\\Custom\\Location"))
                       .AddTransient<ISerializer,CustomSerializer>();

        }

When trying to access my model I get a NullReferenceException like the below stack trace. I'm sure I'm missing something in the registration of the CustomSerializer because the break points in my CustomSerializer class are never hit and the DefaultStoreManager.Initialize method throwing the exception attempts to retrieve the ISerializer from the IServiceProvider.

Any help would be much appreciated.

NullReferenceException: Object reference not set to an instance of an object.

    FileContextCore.StoreManager.DefaultStoreManager.Initialize(IFileContextScopedOptions options, IEntityType entityType, object keyValueFactory)
    FileContextCore.Storage.Internal.FileContextTable<TKey>.Init()
    FileContextCore.Storage.Internal.FileContextTable<TKey>..ctor(IPrincipalKeyValueFactory<TKey> keyValueFactory, bool sensitiveLoggingEnabled, IEntityType entityType, IFileContextScopedOptions options, IServiceProvider serviceProvider)
    FileContextCore.Storage.Internal.FileContextTableFactory+<>c__DisplayClass7_0<TKey>.<CreateFactory>b__0()
    FileContextCore.Storage.Internal.FileContextTableFactory.Create(IEntityType entityType)
    FileContextCore.Storage.Internal.FileContextStore.EnsureTable(object key, IEntityType entityType)
    FileContextCore.Storage.Internal.FileContextStore.GetTables(IEntityType entityType)
    FileContextCore.Query.Internal.FileContextShapedQueryCompilingExpressionVisitor.Table(QueryContext queryContext, IEntityType entityType)
    lambda_method(Closure , QueryContext )
    Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync<TResult>(Expression query, CancellationToken cancellationToken)
    Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync<TResult>(Expression expression, CancellationToken cancellationToken)
    Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable<TResult>.GetAsyncEnumerator(CancellationToken cancellationToken)
    Microsoft.EntityFrameworkCore.Internal.InternalDbSet<TEntity>.System.Collections.Generic.IAsyncEnumerable<TEntity>.GetAsyncEnumerator(CancellationToken cancellationToken)
    System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T>.GetAsyncEnumerator()
    Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync<TSource>(IQueryable<TSource> source, CancellationToken cancellationToken)
    GroceryStoreAPI.Controllers.CustomerController.GetCustomers() in CustomerController.cs

                return await _context.Customers.ToListAsync();

lambda_method(Closure , object )
Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable+Awaiter.GetResult()
Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)
System.Threading.Tasks.ValueTask<TResult>.get_Result()
System.Runtime.CompilerServices.ValueTaskAwaiter<TResult>.GetResult()
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask<IActionResult> actionResultValueTask)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Remove redundant key column

The Key (or __Key__) column is fully redundant. EFCore has easy ways to find out which of the data columns are part of the primary key (through entityType.GetKeys().First(k => k.IsPrimaryKey).GetProperties(). This is especially important for CSV where some legacy formats might expect an exact set of available columns.

I have this change fully implemented and can provide it as soon as #5 is merged (as it relies on some changes that I made there)

Not compatiple with Windows 10 build 10.0.17134

I get following error when I'm trying to install the nuget package in a UWP application.

Severity Code Description Project File Line Suppression State
Error Package FileContextCore 2.1.0 is not compatible with uap10.0.17134 (UAP,Version=v10.0.17134) / win10-arm. Package FileContextCore 2.1.0 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1) 0

ModelBuilder configuration gets ignored

FileContextCore should apply the ModelBuilder configuration that's set in OnModelCreating. I'm working with legacy data and it would be really great to be able to work with ToTable (to set file names), HasColumnName and HasConversion to keep all that weirdness out of my code.

I've written EFCore providers before and normally most of this should come out of the box.

How to retrive all records from the data source

Hi Morris,

I am working on a service fabric project and I want to implement a custom EF core provider so I have gone through a few existing providers and the FileContext provider.

The FileContext provider suites perfect for my requirements. I have made the necessary changes and it is working now.
I am able to perform CRUD operations on the tables and get all records from the source.

Here I observed one scenario, i.e If we want to get all records, we need to use ToList() method otherwise the data is not populated.

Example:

Below are two classes and I would like to join these entities.

`
Class Student
{
[Key]
public Guid StudentId{ get; set; }

public Guid DepartmentId { get; set; }

public string StudentName { get; set; }

}
`

`
Class Department

{
[Key]
public Guid DepartmentId { get; set; }
public string DeptName { get; set; }
}
`

Below is the query in LINQ and executed this scenario, however, the result is null.

var result = from student in dbContext.Students
			join department in dbContext.Departments on student.DepartmentId equals department.DepartmentId
			select new
			 {
				student.StudentName,
			 };

If we modify the above scenario as below, it is giving the expected result.

var result = from student in dbContext.Students.ToList()
			join department in dbContext.Departments.ToList() on student.DepartmentId equals department.DepartmentId
			select new
			 {
				student.StudentName,
			 };

Below is my observation:
We have to get the records using dbContext.Students.ToList() and then perform join.

Question:
Can we get all records using dbContext.Students and proform join condition instead of using ToList()

Data location should be configurable

We have some legacy CSV files that are required to be in a specific location because they are used by multiple applications. It would be very useful to pass a path to a directory to FileContext.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.