entity-model

Entity Framework - not updating referenced model

痴心易碎 提交于 2019-12-24 23:09:56
问题 I have a model, 'Person', that references another model, 'Salutation'. public class Person { public int Id { get; set; } public Boolean Active { get; set; } // fk public virtual Salutation Salutation { get; set; } public virtual PersonName Name { get; set; } } public class Salutation { public int Id { get; set; } public string Name { get; set; } } when I try and UPDATE the 'Person' with a different 'Salutation' it doesn't update. Though if I change the actual data within the 'salutation' it

Could not find the conceptual model type

别来无恙 提交于 2019-12-20 11:44:06
问题 I have two Entity Data models within a MVC3 project A and B. I have recently added the new entity data model B to deal with some new functionality, the issue is that now the existing code has stopped working and I am getting the following error when trying to access code within entity model A. The error message is: Could not find the conceptual model type 'project.models.Bclass' I do not understand why it is this new functionality has affected the current code seeing as entity model A has not

Why does my WCF Service not use my Entity Model?

别等时光非礼了梦想. 提交于 2019-12-20 02:26:15
问题 I got a problem on using WCF service and Entity Model with together. I have created an Entity Model from my existing database. This can be shown below; There isn't any problem while using my classes in any console applicaton coming from "Entity Object Code Generator". Then, I created WCF Service with Interface Below: [ServiceContract] public interface IAuthorServices { [OperationContract] [WebGet( UriTemplate="GetNews")] List<Newspaper> GetNews(); [OperationContract] [WebGet(BodyStyle =

Is it possible to use the VS Entity Diagram designer with ASP.NET MVC 3?

牧云@^-^@ 提交于 2019-12-11 17:34:47
问题 The introductory videos for ASP.NET MVC 3 imply that the desired workflow is for me to declare classes that define my model (code-first design). This strikes me as weird, since Visual Studio has a nice Entity Diagram designer which can generate such classes with navigation properties, etc. Is it possible to use that Entity Diagram designer to design the model (model-first design), and have ASP.NET MVC 3 understand the generated classes as its model? Please provide precise steps if possible :)

Error while Changing the connection string dynamically

最后都变了- 提交于 2019-12-11 16:21:56
问题 Im having this problem when changing my entities connection string. here is the code: SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder(); sqlBuilder.DataSource = @"KURT-PC\SQLEXPRESS"; sqlBuilder.InitialCatalog = "KurtDB"; sqlBuilder.UserID = "Admin"; sqlBuilder.Password = "123456"; sqlBuilder.IntegratedSecurity = false; sqlBuilder.MultipleActiveResultSets = true; EntityConnectionStringBuilder entityBuilder = new EntityConnectionStringBuilder(); entityBuilder.Provider =

Does the length field on the javax.persistence @Column define max?

时间秒杀一切 提交于 2019-12-07 03:54:52
问题 I have this code: public class Item { @Column(name = "serialNo", length = 12) public String getSerialNo() { return this.serialNo; } public void setSerialNo(String serialNo) { this.serialNo = serialNo; } } However, the database schema defines the column to be lenght 13. When the item is retrieved via: List<Item> items = getEntityManager().createNamedQuery(SQL).getResultList(); The data that has serialNo characters equal to 13 (since db table schema allows 13) are still being displayed as 13,

Does the length field on the javax.persistence @Column define max?

本秂侑毒 提交于 2019-12-05 07:40:56
I have this code: public class Item { @Column(name = "serialNo", length = 12) public String getSerialNo() { return this.serialNo; } public void setSerialNo(String serialNo) { this.serialNo = serialNo; } } However, the database schema defines the column to be lenght 13. When the item is retrieved via: List<Item> items = getEntityManager().createNamedQuery(SQL).getResultList(); The data that has serialNo characters equal to 13 (since db table schema allows 13) are still being displayed as 13, not truncated. What is the use of the @Column length then? The javax.persistence.Column 's length

Tables don't show when re-adding them to entity-model (edmx)

僤鯓⒐⒋嵵緔 提交于 2019-12-03 12:13:27
问题 I have a db with 5 tables. At the beginning, I've added those tables in, but then decided to remove some due to some relationship compile error. Now, when i want to add them back, i'm opening the edmx file -> update model from database... I don't see those tables under add tab, but only under the "refresh" tab. How can i add them back? 回答1: In order to re-add a table to your model you will first need to delete the table from your model. (a list of tables is visible in the [model.Store] tree

Could not find the conceptual model type

五迷三道 提交于 2019-12-03 01:45:17
I have two Entity Data models within a MVC3 project A and B. I have recently added the new entity data model B to deal with some new functionality, the issue is that now the existing code has stopped working and I am getting the following error when trying to access code within entity model A. The error message is: Could not find the conceptual model type 'project.models.Bclass' I do not understand why it is this new functionality has affected the current code seeing as entity model A has not change in any way. And functionality B is in a separate class and does not interfere with model A.

Tables don't show when re-adding them to entity-model (edmx)

一世执手 提交于 2019-11-30 06:49:58
I have a db with 5 tables. At the beginning, I've added those tables in, but then decided to remove some due to some relationship compile error. Now, when i want to add them back, i'm opening the edmx file -> update model from database... I don't see those tables under add tab, but only under the "refresh" tab. How can i add them back? mathijsuitmegen In order to re-add a table to your model you will first need to delete the table from your model. (a list of tables is visible in the [model.Store] tree (see ' Model Browser ' pane- you can open it from right-mouse click menu). When you run