entity-framework-4.1

Update model from database per .edmx doesn't update model/cols if deleted from database?

扶醉桌前 提交于 2019-12-11 11:00:47
问题 When I delete a column from an already existing db from an already existing database model, right clicking on the .edmx "Update model from Database" does not remove deleted columns from the model (column existed in the model and db before but was removed from db) . One thing that I have noticed is that my mapping detals are not matching up with my .edmx. Mapping detals are up to date with database but they dont' match that of the .edmx. Is this expected behavior? Thanks! [Using asp.net 4.0

Microsoft Sync Framework, Microsoft Entity Framework 4.1 & SQL CE 4.0

青春壹個敷衍的年華 提交于 2019-12-11 10:29:09
问题 We are developing an occasionally connected application that uses SQL Compact on the client machines and SQL Server 2008 (with change tracking) on the server. The application is being developed using Entity Framework’s code first model, which requires that the local SQL Compact database be 4.0. We would like to use Microsoft Sync Framework to handle synchronizing data from the central server to the occasionally connected clients but recently discovered that while SQL Compact 3.5 SP2 is

Invalid column name after mapping

一个人想着一个人 提交于 2019-12-11 09:37:31
问题 I have added a (bit\bool) column IsController to one of my tables ALTER TABLE P_USER ADD IsController bit NOT NULL DEFAULT 0 Updated the edmx and added IsController to the MY_USER entity, then changed its name to IsControllerX and mapped it to the IsController from the table. And set this inside the solution.domain.business cs file: public virtual bool IsControllerX { get; set; } On debug I have the error: An error occurred while executing the command definition. See the inner exception for

Problem with WCF/EF 4.1 Lazy Loading

我与影子孤独终老i 提交于 2019-12-11 09:02:09
问题 I'm getting data for my application through WCF service. And on the server side the service is using EF4.1 as a data access. Service method looks kind of like this : public List<JobOffer> GetAllJobOffers() { var allJobOffers = _jobOffersRepository.GetAll().ToList(); return allJobOffers; } And the repository is done this way public override IQueryable<JobOffer>GetAll() { return _context.JobOffers.Include(c => c.Company); } I am getting this strange error : An error occurred while receiving the

error 0019: Each property name in a type must be unique on ID field

℡╲_俬逩灬. 提交于 2019-12-11 08:44:57
问题 ANSWERED! (will be posting it shortly. I seriously think it's a bug in EF.) I have the following set of (code-first) classes which will be the future of the application as we are replacing the old (gen'd from db). The dbcontext, two mappings/configurations, two POCOs, and a base class. In addition to this in another project entirely is an edmx generated from the database. Up until now, there have not been any issues with the two conflicting. There are several other unrelated sets in the

EF 4.1 Multiple Many to Many relationships in single class

旧城冷巷雨未停 提交于 2019-12-11 07:39:31
问题 I have a class with multiple many to many relationships mapping to the same secondary class. My EquipmentSet class has two arrays of Equipment objects, and the Equipment class also has an array of EquipmentSets to determine which sets the equipment is a part of. EF is only generating a lookup table for the second Many to Many relationship. How can I tell EF to generate lookup tables for both? When the code below is used, only the table "ModelSpecificEquipment" is generated. The table

Cannot Generate Database from Entity Framework 4.1 Codefirst With SQL Server 2005

痞子三分冷 提交于 2019-12-11 07:39:27
问题 I try to create database from entity framework code first follow with this tutorial http://www.asp.net/mvc/tutorials/getting-started-with-mvc3-part4-cs but I use SQL Server 2005 instead when SQLExpress but When I execute solution don't have anything create. What wrong with my code This is my code. Movie.cs public class Movie { public int ID { get; set; } public string Title { get; set; } public DateTime ReleaseDate { get; set; } public string Genre { get; set; } public decimal Price { get;

Can I use Self Tracking Entities and DBContext in Entity Framework 4.1?

旧街凉风 提交于 2019-12-11 07:04:27
问题 I want to know if DBContext (EF 4.1) supports Self Tracking Entities. If yes, how can I do that? 回答1: No unless you rewrite the template to support them. The current template is dependent on ObjectContext API. 来源: https://stackoverflow.com/questions/6646281/can-i-use-self-tracking-entities-and-dbcontext-in-entity-framework-4-1

Entity Framework 4.1 detach scenario cascading update

半城伤御伤魂 提交于 2019-12-11 07:00:57
问题 I have worked with EF CTP4 and there wasnt any easy way how to perform cascading udate in detached scenario. Example: I have tree of elements which gets send from server to client (it gets detached). Client modifies this tree (properties and relations) and sends it back to server. Now I want to attach this tree and save it without much hustle. My question is this posible in EF CTP5 and if not is it planned? Im wondering if EF will reach maturity of NHibernate where this is possible (where I

ASP/MVC3 Razor Linq

倖福魔咒の 提交于 2019-12-11 06:56:45
问题 I keep getting this error for my project. The model item passed into the dictionary is of type 'System.Collections.Generic.List 1[<>f__AnonymousType2 2[System.String,System.String]]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[ETMS.Models.DB.tblParent]'. 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 originated in the