ef-code-first

Search date from the detail asp.Net mvc 5

大兔子大兔子 提交于 2021-02-08 12:13:06
问题 on clicking search,nothing happenI am trying to filter the detail with date property in asp.net mvc 5 code first. but it's not working. i have only create a model class from which code first generate a controller and view for it. now i want to filter the detail on the index page with respect to date. here is the code i am using. Model Class:- public class Meeting { public int MeetingID { get; set; } public String Name { get; set; } public String designation { get; set; } [Display(Name = "9:00

Search date from the detail asp.Net mvc 5

拜拜、爱过 提交于 2021-02-08 12:07:07
问题 on clicking search,nothing happenI am trying to filter the detail with date property in asp.net mvc 5 code first. but it's not working. i have only create a model class from which code first generate a controller and view for it. now i want to filter the detail on the index page with respect to date. here is the code i am using. Model Class:- public class Meeting { public int MeetingID { get; set; } public String Name { get; set; } public String designation { get; set; } [Display(Name = "9:00

Entity Framework 6 query returning record with data not yet saved in the database

纵然是瞬间 提交于 2021-02-08 07:51:14
问题 I created a very simple test project using Entity Framework 6 Code-first and I'm trying to understand how change tracking works. In my simple test I have a Blogs table and I insert a Blog with a name "User1", after inserting and saving I modify the object used to insert (name="User1 modified") but without saving changes. Right after that I query my database. For my surprise the query from the db is returning the modified record even though I did not save my changes after the update. Why is

Can MSI work with EF CodeFirst?

安稳与你 提交于 2021-02-07 19:39:46
问题 I've gotten stuck on this for quite a while now, with no luck advancing it on my own. I am trying to connect from an Azure App Service to a EF CodeFirst managed database, using an MSI token. When I deployed the App Service using ARM I produced an Output that ensured that it created a Service Principal: { "principalId":"98f2c1f2-0a86-4ff1-92db-d43ec0edxxxx"," tenantId":"e6d2d4cc-b762-486e-8894-4f5f440dxxxx", "type":"SystemAssigned" } In Kudu the environment variables show that it is being

How to call Stored Procedure with join on multiple tables in Entity Framework Core?

喜欢而已 提交于 2021-02-07 19:16:11
问题 I have to call a stored procedure which is selecting records from multiple tables. I have tried the following code, but it's returning null for columns from other tables than the entity class. private async Task<IEnumerable<TEntity>> InvokeStoredProcedureAsync(string input = "") { var storedProcedureName = "sp_BulkSelect"; using (var db = new MyDbContext(_options)) { var result = await db.Set<TEntity>().FromSql(storedProcedureName + " @inputIds", new SqlParameter("inputIds", input))

How to call Stored Procedure with join on multiple tables in Entity Framework Core?

隐身守侯 提交于 2021-02-07 19:15:15
问题 I have to call a stored procedure which is selecting records from multiple tables. I have tried the following code, but it's returning null for columns from other tables than the entity class. private async Task<IEnumerable<TEntity>> InvokeStoredProcedureAsync(string input = "") { var storedProcedureName = "sp_BulkSelect"; using (var db = new MyDbContext(_options)) { var result = await db.Set<TEntity>().FromSql(storedProcedureName + " @inputIds", new SqlParameter("inputIds", input))

EF Code First abstract relationship?

若如初见. 提交于 2021-02-07 18:31:56
问题 I have a class that inherits a base class to which another class has relationships. Example: Base class: Animal Subclass 1: Dog Subclass 2: Cat Related one-to-many table: Vaccinations A dog can have multiple vaccinations. This is implemented as a List<Vaccination>. A cat can have multiple vaccinations. A vaccination record can only have one animal associated with it. A vaccination doesn't know if it's associated with a dog or a cat. (Dogs and cats use non-colliding GUIDs.) There is no Animal

EF Code First abstract relationship?

六眼飞鱼酱① 提交于 2021-02-07 18:31:31
问题 I have a class that inherits a base class to which another class has relationships. Example: Base class: Animal Subclass 1: Dog Subclass 2: Cat Related one-to-many table: Vaccinations A dog can have multiple vaccinations. This is implemented as a List<Vaccination>. A cat can have multiple vaccinations. A vaccination record can only have one animal associated with it. A vaccination doesn't know if it's associated with a dog or a cat. (Dogs and cats use non-colliding GUIDs.) There is no Animal

Entity Framework multiple references to same table

柔情痞子 提交于 2021-02-07 18:30:09
问题 I'm having trouble creating my database with EF code-first. I have an entity Player and an entity friedship. Each friendship references two players. One of the players is the sender, the other one is the receiver of the friendship. This are my entities: Player.cs public class Player { public int PlayerId { get; set; } [Required] public string Name { get; set; } [Required] public string Email { get; set; } [InverseProperty("Receiver")] public virtual List<Friendship> FriendshipsIncoming { get;

EF Code First 6.1 Change ID from Int to Long

﹥>﹥吖頭↗ 提交于 2021-02-07 17:24:33
问题 I'm working on an application that is using ASP.Net MVC 4, C# and Entity Framework Code First. There is one model (Table) that is growing rather large and I'm worried that the Identity column will run out of values (Int32.MaxValue) in the next year or so. I'm looking for a way to change this identity from int to a long. In the past when I tried this, EF wouldn't let me do this unless if it dropped the table and recreated it. This is not an option since the site is already live and there is