优化计算属性实体框架

时间:2016-12-12 13:33:34

标签: c# .net asp.net-mvc entity-framework entity-framework-6

我有一个模特:

12-12 15:01:18.436 27069-27069/com.platinum.hydro E/AndroidRuntime: FATAL EXCEPTION: main
   Process: com.platinum.hydro, PID: 27069
   java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
       at com.google.firebase.FirebaseApp.<clinit>(Unknown Source)
       at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
       at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
       at android.app.ActivityThread.installProvider(ActivityThread.java:5319)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:4893)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4833)
       at android.app.ActivityThread.access$1500(ActivityThread.java:178)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531)
       at android.os.Handler.dispatchMessage(Handler.java:111)
       at android.os.Looper.loop(Looper.java:194)
       at android.app.ActivityThread.main(ActivityThread.java:5631)
       at java.lang.reflect.Method.invoke(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/com.platinum.hydro-2/base.apk"],nativeLibraryDirectories=[/data/app/com.platinum.hydro-2/lib/arm, /vendor/lib, /system/lib]]
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
       at com.google.firebase.FirebaseApp.<clinit>(Unknown Source) 
       at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
       at android.content.ContentProvider.attachInfo(ContentProvider.java:1751) 
       at android.content.ContentProvider.attachInfo(ContentProvider.java:1726) 
       at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
       at android.app.ActivityThread.installProvider(ActivityThread.java:5319) 
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:4893) 
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4833) 
       at android.app.ActivityThread.access$1500(ActivityThread.java:178) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531) 
       at android.os.Handler.dispatchMessage(Handler.java:111) 
       at android.os.Looper.loop(Looper.java:194) 
       at android.app.ActivityThread.main(ActivityThread.java:5631) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at java.lang.reflect.Method.invoke(Method.java:372) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754) 
    Suppressed: java.lang.ClassNotFoundException: android.support.v4.util.ArrayMap
       at java.lang.Class.classForName(Native Method)
       at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
       at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
            ... 18 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

据我所知,每次public class Genre : DbObject { public string GenreName { get; set; } public virtual ICollection<Book> Books { get; set; } = new List<Book>(); public virtual int BooksCount => Books.Count; } 都是对数据库的请求,以计算BooksCount集合中的对象数。也许只有在集合发生变化时才会在数据库中更改属性Books的方法?

0 个答案:

没有答案