entity-framework

About c# partial class accesibility

僤鯓⒐⒋嵵緔 提交于 2020-01-05 13:53:25
问题 I have a question about partial classes in c# In This picture, I have a domain model. I am have added reference this(DomainModelLib) to Client application and repoistory application. Repository application is using this domain model classes as "DbSet" and getting data from database. Realtions are created in model partial classes as you can see. I referenced Model to Client application. I wanna first partial(first red frame) of Product class can access in Client application but second part

The object cannot be deleted because it was not found in the ObjectStateManager error when deleting item

人走茶凉 提交于 2020-01-05 13:12:36
问题 I am trying to delete an item from my AspNetRoles table that has been extended like this: public class AspApplicationRoles : IdentityRole { public AspApplicationRoles() : base() { } public AspApplicationRoles(String Name) : base(Name) { } [Required] public String ApplicationId { get; set; } public AspNetApplications Application { get; set; } } This is the way I am trying to delete it. I use the Get function with an Input of its ID to get the item and try to delete it. However, I get this

The object cannot be deleted because it was not found in the ObjectStateManager error when deleting item

痞子三分冷 提交于 2020-01-05 13:11:36
问题 I am trying to delete an item from my AspNetRoles table that has been extended like this: public class AspApplicationRoles : IdentityRole { public AspApplicationRoles() : base() { } public AspApplicationRoles(String Name) : base(Name) { } [Required] public String ApplicationId { get; set; } public AspNetApplications Application { get; set; } } This is the way I am trying to delete it. I use the Get function with an Input of its ID to get the item and try to delete it. However, I get this

How to show the data based on current logged in user in MVC 4? [closed]

為{幸葍}努か 提交于 2020-01-05 12:38:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I have login authentication based asp.net MVC 4 application with Entity Framework. Here, user can get registered themselves and add their own records in the application. So, Whenever they are logging in, they should just see their own records and not others. Would like to filter

Convention for DatabaseGeneratedOption.None

风格不统一 提交于 2020-01-05 12:30:33
问题 I would like to manually insert id for all my entities. Is it possible to create some kind of convention or I have to set HasDatabaseGeneratedOption(DatabaseGeneratedOption.None) (or add DatabaseGenerated attribute) for every entity ? EDIT There is a simpler way to do this then using accepted answer: modelBuilder.Conventions.Remove<StoreGeneratedIdentityKeyConvention>(); 回答1: It's possible to create custom conventions in EntityFramework 6 as follows: Create a convention class public class

ASP.NET and Entity Framework Customizing The GridView Field Header

为君一笑 提交于 2020-01-05 12:13:11
问题 Can you please let me know how I can Customize the header for fields in Grid View using Entity Framwork and ASP.NET? For Example I have dbcontext instance which is showing on the GridView like this image: Now I would like to change the Header Style, Format and Presentation to some thing like this: I am gussing some part of job can be done through CSS styling like changing color but for Changing the CONTRACTORID TO Contractor ID I do not know how to do it? Can you please let me know how to

Firebird embeded and EntityFramework code first: what's the correct way to set connection string and provider?

自闭症网瘾萝莉.ら 提交于 2020-01-05 12:11:22
问题 I have to use Firebird embeded database and Entity Framework. I have downloaded the Connector and if i use this code: using FirebirdSql.Data.FirebirdClient; [...] string exePath = Path.GetDirectoryName( new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); FbConnectionStringBuilder fbStringBuilder = new FbConnectionStringBuilder(); fbStringBuilder.ServerType = FbServerType.Embedded; fbStringBuilder.UserID = "SYSDBA"; fbStringBuilder.Password = "MASTERKEY"; fbStringBuilder.Dialect = 3;

Firebird embeded and EntityFramework code first: what's the correct way to set connection string and provider?

痞子三分冷 提交于 2020-01-05 12:10:22
问题 I have to use Firebird embeded database and Entity Framework. I have downloaded the Connector and if i use this code: using FirebirdSql.Data.FirebirdClient; [...] string exePath = Path.GetDirectoryName( new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); FbConnectionStringBuilder fbStringBuilder = new FbConnectionStringBuilder(); fbStringBuilder.ServerType = FbServerType.Embedded; fbStringBuilder.UserID = "SYSDBA"; fbStringBuilder.Password = "MASTERKEY"; fbStringBuilder.Dialect = 3;

Entity Framework update table with rowguid

半腔热情 提交于 2020-01-05 12:09:06
问题 I am using MERGE REPLICATION on my server and now all tables have a rowguid , the last models generated before this change is working very good, but now the new table I imported (using database-first) get the rowguid and making impossible to update, I deleted this column in Model.edmx and I got this error. Error 3023: Problem in mapping fragments starting at line 551: Column Location.rowguid in table Location must be mapped: It has no default value and is not nullable. 回答1: You can backup

Entity Framework update table with rowguid

一笑奈何 提交于 2020-01-05 12:08:27
问题 I am using MERGE REPLICATION on my server and now all tables have a rowguid , the last models generated before this change is working very good, but now the new table I imported (using database-first) get the rowguid and making impossible to update, I deleted this column in Model.edmx and I got this error. Error 3023: Problem in mapping fragments starting at line 551: Column Location.rowguid in table Location must be mapped: It has no default value and is not nullable. 回答1: You can backup