I have the following model I’m calling this function The above is trying to reproduce the following sql However it’s generating the following nasty piece of work: As you can see, it’s generating CHARINDEX for the StartsWith. The problem is this is ignoring all the indexing I have setup, and takes many seconds to run on 5 million records. How
Tag: entity-framework
Two entities with possibly different keys are mapped to the same row
I have Table Field1 PK int not null Field2 PK int not null like this when i want to map this table I get this error Error 3 Error 3034: Problem in mapping fragments starting at lines 2212, …
Performance for using 2 where clauses in LINQ
In LINQ-to-Entities you can query entities by doing: I know that behind the scenes it will be translated to SQL to something similar to: However is there a difference (with respect to performance) if I write: Will it be translated to the same SQL query? From my understanding .Where() will return IEnumerable<T> so the second .Where() will filter the entities
The provider did not return a ProviderManifestToken string Entity Framework
An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure …
Stored procedure returns int instead of result set
I have a stored procedure that contains dynamic select. Something like this: In SSMS the stored procedure runs fine and shows result set. In C# using Entity Framework it shows returning an int instead of IEnumerable? Generated function for usp_GetTestRecords Answer Entity Framework can’t tell what your stored procedure is returning. I’ve had success creating a table variable that mirrors
Can I change the default schema name in entity framework 4.3 code-first?
Currently I am deploying my application to a shared hosting environment and code-first with migrations has been working great except for one minor hiccup. Everytime I want to push the site I have to use the “Update-Database -script” option because I have to prepend every table name with [dbo] because by default the shared host creates a default schema name
Solution for: Store update, insert, or delete statement affected an unexpected number of rows (0) [closed]
I found a solution for people who get an exception: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were …
Fastest Way of Inserting in Entity Framework
I’m looking for the fastest way of inserting into Entity Framework. I’m asking this because of the scenario where you have an active TransactionScope and the insertion is huge (4000+). It can potentially last more than 10 minutes (default timeout of transactions), and this will lead to an incomplete transaction. Answer To your remark in the comments to your question:
Entity Framework and SQL Server adds blanks in strings?
I am building a ASP.NET MVC application with Entity Framework and SQL Server. I have noticed that when I read back SQL Server columns of type nchar or text there will be added blanks at the end of …
SQL – Multiple one-to-many relationships
Is it possible somehow to do multiple one-to-many relationships between 2 tables? Like: Table abc abcID defID message Table def defID abcID message If yes how can I then make a new abc entry with …