entity-framework-5

why does visual studio delete my classes when I update entity framework model

依然范特西╮ 提交于 2020-01-01 05:18:05
问题 I'm having a strange problem when I update my EF model (ver 5). It deletes all of the classes that belong to that model. My situation was like this. I changed the key column of two tables which have references to my primary table. Updating the model did not make these changes to the edmx, so I removed those three table (primary and two lookup tables), saved the edmx. Then updated the model and added those tables back in. Once I saved the model after updating it, VS deleted all of the class

Entity Framework 5.0 PostgreSQL (Npgsql) default connection factory

折月煮酒 提交于 2020-01-01 02:43:09
问题 I'm trying to get EF 5.0 code first working with PostgreSQL (Npgsql provider). I have Npgsql 2.0.12.1 installed via NuGet (referenced assembly is 2.0.12.0 though). I have Npgsql declared in app.config (both default connection factory and provider factory): <entityFramework> <defaultConnectionFactory type="Npgsql.NpgsqlFactory, Npgsql, Version=2.0.12.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" /> </entityFramework> <system.data> <DbProviderFactories> <add name="Npgsql Data Provider"

Entity Framework 5 poor performance

空扰寡人 提交于 2019-12-31 01:58:48
问题 I have 5 entities: public class Album { public int Id { get; set; } public string Title { get; set; } public virtual List<AlbumArtist> AlbumArtists { get; set; } public virtual List<Artist> Artists { get; set; } public virtual List<Genre> Genres { get; set; } public virtual List<Song> Songs { get; set; } } public class AlbumArtist { public int Id { get; set; } public string Title { get; set; } public virtual List<Album> Albums { get; set; } public virtual List<Artist> Artists { get; set; }

DatePicker.Value.Set Error binding to datasource

别来无恙 提交于 2019-12-31 00:01:28
问题 I have a bindingsource control called binding, on a form in VS2012, and a DateTimePicker control bound to it. for the binding properties I have MinDate = 1/01/1753 and MaxDate = 31/12/9998 Value has been set by picking Today from the calender 5/04/2013 11:27 AM I set a bindingsource up using var dset = base.Context.ContactEvents; var qry = dset.Where(p => p.Id > 0).OrderBy(x => x.Id); qry.Load(); this.bindingSource.DataSource = dset.Local.ToBindingList(); The bindingsource is used in the

Entity Framework 5 : Proper method to replace entry in context

邮差的信 提交于 2019-12-30 17:14:44
问题 What i want to do is simple. I have a list of parts in the db, and i want to delete/insert/update them according to an update list. The main issue is that, when i want to replace an entry i can't attach it to the context because the older(to be updated) entry is already attached (by previous read call) and an exception is thrown. I came around with 3 thoughts. Manually Detach the old entry and attach the new one (although changing entity state to detached still throws exception) Manually

ASP.NET Webforms CRUD scaffolding with Entity Framework 5

雨燕双飞 提交于 2019-12-30 13:14:46
问题 Back in Feb MS introduced: http://www.nuget.org/packages/Microsoft.AspNet.Scaffolding.WebForms/ http://blogs.msdn.com/b/webdev/archive/2013/02/20/pre-release-of-asp-net-scaffolding-with-a-web-forms-scaffold-generator.aspx but it appears that it will be dropped from VS2013 ASP.NET Web Forms Scaffolding feature missing in VS 2013 RC I followed the instructions here http://dotnetguts.blogspot.com.au/2013/06/scaffolding-for-aspnet-webforms.html to install the package under Visual Studio 2012 but

The entity type is not part of the model, EF 5

耗尽温柔 提交于 2019-12-30 08:42:52
问题 I am trying to update my repository to EF5 but have encountered a few errors. I've taken a look around stackoverflow for similar errors discovered a few questions/answers but unfortunately the same answers didn't resolve my issue. This is my error: The entity type User is not part of the model for the current context. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it

The entity type is not part of the model, EF 5

不打扰是莪最后的温柔 提交于 2019-12-30 08:42:15
问题 I am trying to update my repository to EF5 but have encountered a few errors. I've taken a look around stackoverflow for similar errors discovered a few questions/answers but unfortunately the same answers didn't resolve my issue. This is my error: The entity type User is not part of the model for the current context. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it

The entity type is not part of the model, EF 5

▼魔方 西西 提交于 2019-12-30 08:42:05
问题 I am trying to update my repository to EF5 but have encountered a few errors. I've taken a look around stackoverflow for similar errors discovered a few questions/answers but unfortunately the same answers didn't resolve my issue. This is my error: The entity type User is not part of the model for the current context. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it

An exception of type 'AutoMapper.AutoMapperMappingException' occurred in AutoMapper.dll but was not handled in user code

北战南征 提交于 2019-12-30 08:13:47
问题 Somehow my code doesn't work any more (it did work before with the exact same code). This is the problem: The code I'm trying to map some objects to ViewModels with this code: Configuration: Mapper.CreateMap<BookcaseItem, FoundBookcaseItemViewModel>() .ForMember(x => x.Title, opt => opt.MapFrom(src => src.Book.Title)) .ForMember(x => x.Authors, opt => opt.MapFrom(src => src.Book.Authors.Select(x => x.Name).Aggregate((i, j) => i + ", " + j))) .ForMember(x => x.Identifiers, opt => opt.MapFrom