Entity Framework 4 / POCO – Where to start? [closed]

These articles might be of interest…the series really gets into the advantages and disadvantages of a POCO approach. Link Link Link In these articles the author mentions future articles that describe best practices in implementing Repository and Unit of Work patterns, but I can’t find them. These articles are well written and I’d like to … Read more

The term ‘scaffold-dbcontext’ is not recognized as the name of a cmdlet, function, script file, or operable program

For me apparently it worked once I have also ran in Package Manager console : Install-Package Microsoft.EntityFrameworkCore.Tools Also make sure : To have other dependencies (for example Microsoft.EntityFrameworkCore, Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.SqlServer.Design…) referenced depending of your needs. To select the right assembly as target for your commands in the top-right corner of the PM console (I am … Read more

Unable to create a constant value of type Only primitive types or enumeration types are supported in this context

This cannot work because ppCombined is a collection of objects in memory and you cannot join a set of data in the database with another set of data that is in memory. You can try instead to extract the filtered items personProtocol of the ppCombined collection in memory after you have retrieved the other properties … Read more

A circular reference was detected while serializing an object of type ‘SubSonic.Schema .DatabaseColumn’.

It seems that there are circular references in your object hierarchy which is not supported by the JSON serializer. Do you need all the columns? You could pick up only the properties you need in the view: return Json(new { PropertyINeed1 = data.PropertyINeed1, PropertyINeed2 = data.PropertyINeed2 }); This will make your JSON object lighter and … Read more

Entity Framework Core: A second operation started on this context before a previous operation completed

I am not sure if you are using IoC and Dependency Injection to resolve your DbContext where ever it might be used. If you do and you are using native IoC from .NET Core (or any other IoC-Container) and you are getting this error, make sure to register your DbContext as Transient. Do services.AddDbContext<MyContext>(ServiceLifetime.Transient); OR … Read more

entity object cannot be referenced by multiple instances of IEntityChangeTracker. while adding related objects to entity in Entity Framework 4.1

Because these two lines … EmployeeService es = new EmployeeService(); CityService cs = new CityService(); … don’t take a parameter in the constructor, I guess that you create a context within the classes. When you load the city1… Payroll.Entities.City city1 = cs.SelectCity(…); …you attach the city1 to the context in CityService. Later you add a … Read more

“Items collection must be empty before using ItemsSource.”

I had this same error for a while in a slightly different scenario. The cause was invalid XAML, because some tags were missing. I had <wpftoolkit:DataGrid AutoGenerateColumns=”False” ItemsSource=”{Binding Path=Accounts}” > <wpftoolkit:DataGridTextColumn Header=”Account Name” Binding=”{Binding Path=AccountName}” /> </wpftoolkit:DataGrid> which I fixed to be <wpftoolkit:DataGrid AutoGenerateColumns=”False” ItemsSource=”{Binding Path=Accounts}” > <wpftoolkit:DataGrid.Columns> <wpftoolkit:DataGridTextColumn Header=”Account Name” Binding=”{Binding Path=AccountName}” /> </wpftoolkit:DataGrid.Columns> … Read more