When use EFCore In ConsoleApp ,a "FileNotFoundException" occurred.
Code just like this:
EFCoreDbContext ctx = new EFCoreDbContextFactory().Create();
var query=ctx.Movies.DeferredCount();
Can you post the full Stack Trace (or send it by email if you want to keep it private)?
The DeferredCount only defer the query and doesn't execute it unless you call the method. Using the code you posted, I cannot reproduce this issue without more information.
System.IO.FileNotFoundException was unhandled
FileName=EntityFramework.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
HResult=-2147024894
Message=Could not load file or assembly 'EntityFramework.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. 系统找不到指定的文件。
Source=Z.EntityFramework.Plus.EFCore
StackTrace:
at Z.EntityFramework.Plus.QueryDeferred1..ctor(IQueryable query, Expression expression) at Z.EntityFramework.Plus.QueryDeferredExtensions.DeferredCount[TSource](IQueryable1 source)
at HelloEFCore.Program.Main(String[] args) in C:\Programming\Demos\HelloEFCore\src\HelloEFCore\Program.cs:line 16
InnerException:
Judging by the error, you probably use a different version of EntityFramework.Core from the one (EFCore R1) used to build the EF+ library.
If you already use EFCore R2, we are currently migrating all our project to this version. We hope to release all versions next week.
Yes, I did use EFCore RC2.
Thanks for your reply.
Hello xbuilder,
Just to let you know, the version 1.2.0 supporting RC2 is now released.