SNIReadSyncOverAsync and WaitForSingleObject blocking EF performance?

I am doing some profiling on a WCF service that uses EF (System.Data.Entities) to read from a SQL DB. When I spin up multiple parallel clients that hit the service, the CPUs all go to 100%, performance generally tanks, and everything bogs down. In profiling this with the concurrency profiler, I found 85% of the … Read more

The object ‘DF__*’ is dependent on column ‘*’ – Changing int to double

Basically I got a table in my EF database with the following properties: public int Id { get; set; } public string Title { get; set; } public string Description { get; set; } public string Image { get; set; } public string WatchUrl { get; set; } public int Year { get; set; } … Read more

What’s the difference(s) between .ToList(), .AsEnumerable(), AsQueryable()?

I know some differences of LINQ to Entities and LINQ to Objects which the first implements IQueryable and the second implements IEnumerable and my question scope is within EF 5. My question is what’s the technical difference(s) of those 3 methods? I see that in many situations all of them work. I also see using … Read more

What effect(s) can the virtual keyword have in Entity Framework 4.1 POCO Code First?

Does the virtual keyword has an effect when used on the properties in EF Code First?. Can someone describe all of its ramifications in different situations? For instance, I know it can control lazy loading — if you use the virtual keyword on an ICollection/one-to-many relationship property, it will be lazy-loaded by default, whereas if … Read more

The model backing the context has changed since the database was created

The error message : “The model backing the ‘AddressBook’ context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance. For example, the RecreateDatabaseIfModelChanges strategy will automatically delete and recreate the database, and optionally seed it with new data.” I am trying to use the code-first … Read more

Introducing FOREIGN KEY constraint may cause cycles or multiple cascade paths – why?

I’ve been wrestling with this for a while and can’t quite figure out what’s happening. I have a Card entity which contains Sides (usually 2) – and both Cards and Sides have a Stage. I’m using EF Codefirst migrations and the migrations are failing with this error: Introducing FOREIGN KEY constraint ‘FK_dbo.Sides_dbo.Cards_CardId’ on table ‘Sides’ … Read more

EF Migrations: Rollback last applied migration?

This looks like a really common task, but I can’t find an easy way to do it. I want to undo the last applied migration. I would have expected a simple command, like PM> Update-Database -TargetMigration:”-1″ Instead, all I can come up with is: PM> Get-Migrations Retrieving migrations that have been applied to the target … Read more

There is already an open DataReader associated with this Command which must be closed first

I have this query and I get the error in this function: var accounts = from account in context.Accounts from guranteer in account.Gurantors select new AccountsReport { CreditRegistryId = account.CreditRegistryId, AccountNumber = account.AccountNo, DateOpened = account.DateOpened, }; return accounts.AsEnumerable() .Select((account, index) => new AccountsReport() { RecordNumber = FormattedRowNumber(account, index + 1), CreditRegistryId = account.CreditRegistryId, DateLastUpdated … Read more