entity-framework-6

The entity type ApplicationUser is not part of the model : Using Webforms

南笙酒味 提交于 2019-12-11 17:48:43
问题 I have reviewed several answers to this on StackOverflow, and I have applied and compared with no answer to my particular case. Here is what I have up to this point: *****In Web.Config***** <add name="DefaultConnection" connectionString="Data Source=LAPTOP-2UA8GL6L\SQLEXPRESS;Initial Catalog=FHSF_DEV;Integrated Security=True" providerName="System.Data.SqlClient" /> in IdentityModels.cs public class ApplicationUser : IdentityUser { public DateTime BirthDate { get; set; } public string City {

Entity Framework 6 - Parameter query 11x slower than inline parameters query. Why?

六眼飞鱼酱① 提交于 2019-12-11 17:23:09
问题 Profiling some queries in our product, I found that use of Entity Framework 6 parameters impact on performance with this one query. There are many topics on this, both with difference of opinions. In my testing case, these two queries are identical, with the exception that I have placed the params inline the SQL. DBCC DROPCLEANBUFFERS DBCC FREEPROCCACHE SET STATISTICS TIME ON exec sp_executesql N'SELECT DISTINCT [Extent1].[POSTerminalID] AS [POSTerminalID] FROM [dbo].[POSDataEvents] AS

Identity Server 4 with EF Identity DB Issue

隐身守侯 提交于 2019-12-11 16:59:02
问题 I'm trying to setup an Identity Server 4 solution with EF Identity DB. The issue I'm having maybe with info stored in the Identity DB. Not sure if I have the client, API, Provision, Scopes... setup correct. This is my first attempt working with EF Identity DB. I can post DB info if it helps resolve the issue. I'm able to login and retrieve the Secure User Claim information, The Identity Server (Request from API) Token request validation and Token validation are successful. Log info below:

Multiple Sybase dlls are loaded when using entity framework

被刻印的时光 ゝ 提交于 2019-12-11 16:50:49
问题 I am using SQL Anywhere 17 and entity framework 6. When I try to get some data from the database I get this exception. An exception of type 'System.InvalidCastException' occurred in EntityFramework.dll but was not handled in user code Additional information: [A]Sap.Data.SQLAnywhere.SAConnection cannot be cast to [B]Sap.Data.SQLAnywhere.SAConnection. Type A originates from 'Sap.Data.SQLAnywhere.v4.5, Version=17.0.0.10624, Culture=neutral, PublicKeyToken=f222fc4333e0d400' in the context

LINQ to Entities does not recognize the method Boolean ContainsAny

心已入冬 提交于 2019-12-11 16:29:24
问题 Error LINQ to Entities does not recognize the method 'Boolean ContainsAny(System.String, System.String[])' method, and this method cannot be translated into a store expression. Code var predicate = FilterClients(clientRequest); clients = db.Clients.Where(predicate).Include(x => x.Organization) .Include(x => x.Department).ToList(); private Expression<Func<Client, bool>> FilterClients(ClientRequest clientRequest) { var predicate = PredicateBuilder.True<Client>(); if (clientRequest

OnModelCreating only called once even for new contexts

限于喜欢 提交于 2019-12-11 16:09:44
问题 I have multiple SQL server tables that are the same, but differ in content. In writing a code first EF6 program I am trying to reuse the same db context for each and pass in the table name to the context constructor. However, while the constructor is being called every time, the OnModelCreating method is only being called once despite the db context being created from new every time. How do I reset this? I have tried using AsNoTracking and I read along the lines of disabling ModelCaching but

Can not use .ToListAsync() extension method (.net 4.7)

杀马特。学长 韩版系。学妹 提交于 2019-12-11 15:27:21
问题 Im am trying to use extension method .ToListAsync() but for some reason this extension method not available for me. My set up as follows: Web Project (.Net 4.7) here i did include using System.Data.Entity; DataAcess Project (.Net 4.7) here I interlude Entity Frame Work v6.2 My Web Project does reference my DataAccess project. Im not sure where i went wrong. Can somebody please advise? Thank you! 回答1: The ToListAsync method is part of the QueryableExtensions class which is in the System.Data

Entity Framework seed -> SqlException: Resetting the connection results in a different state than the initial login. The login fails.

六眼飞鱼酱① 提交于 2019-12-11 15:04:15
问题 I get the following exception when running the seed method for Entity Framework. I only get the exception once, if I run the seed method a second time when the database has already been altered the code works. What can I do so that I don't have to run the code twice when creating the database the first time? I wan't to use seed and not alter the database using a custom migration. SqlException: Resetting the connection results in a different state than the initial login. The login fails. Login

Adding to or updating an entity in a foreach loop takes too long time before calling SaveChanges()?

时光怂恿深爱的人放手 提交于 2019-12-11 14:44:43
问题 I have this method that saves an entity with its related items (many-to-many relationship), private static void Save<T>(TbCommonHistoryLog log, List<T> lstDetails) where T : IHasSerial { foreach (var item in lstDetails.OrderBy(x => x.Serial)) { var ser = SerializeObject(item); var record = oContext.TbHistoryLog_Lists.FirstOrDefault(x => x.ListObjectJson == ser); if (record == null) //add new list item { TbCommonHistoryLog_Lists listObject = new TbCommonHistoryLog_Lists() { ListObjectJson =

MVC 4 and EF6 database first: issue with mapping

ぃ、小莉子 提交于 2019-12-11 13:56:49
问题 I am following along Pro ASP.NET MVC 4 by Adam Freeman on VS 2010 (I downloaded the MVC 4 template online). I have worked with the .edmx file before, but in Chapter 7 he does not do this. I setup a basic connection string with SQL Server in my web.config file within my WebUI project where my controllers and views are located. Also, I listed my Domain classes within my Domain project below. The problem comes when I run the application. The application is not recognizing my table in my database