entity-framework

Using TransactionScope with Stored Procedure Transaction does not work

耗尽温柔 提交于 2020-12-13 03:32:35
问题 As per my understanding, C# TransactionScope can still work when wrapping a T-SQL BEGIN / COMMIT TRANSACTION inside a stored procedure. I have the following C# method which does EF Save first, then call a stored procedure that has its own transaction and then call external service over HTTP public async Task DoSomething(MyDto dto) { using (var scope = new TransactionScope()) { //Save First var myEntity = await _dbContext.MyEntity.Where(x=>x.Id == dto.Id).SingleOtDefaultAsync(); // Assign

Using TransactionScope with Stored Procedure Transaction does not work

橙三吉。 提交于 2020-12-13 03:30:39
问题 As per my understanding, C# TransactionScope can still work when wrapping a T-SQL BEGIN / COMMIT TRANSACTION inside a stored procedure. I have the following C# method which does EF Save first, then call a stored procedure that has its own transaction and then call external service over HTTP public async Task DoSomething(MyDto dto) { using (var scope = new TransactionScope()) { //Save First var myEntity = await _dbContext.MyEntity.Where(x=>x.Id == dto.Id).SingleOtDefaultAsync(); // Assign

Net Core: Entity Framework and SQL Server Temporal Tables, Automatic Scaffolding

你说的曾经没有我的故事 提交于 2020-12-13 03:17:07
问题 We are having issues using Entity Framework Core 2.2 with SQL Server temporal SystemVersioningTables. The following resolve issues with Entity Framework and system versioning columns. entityframework core and sql 2016 temporal tables Using the solution, is there a way for Entity Framework Core 2.2 to automatically add DatabaseGeneratedOption.Computed or OnModelCreating on SystemVersioning columns? Is there a command parameter in dotnet ef dbcontext scaffold ? We are seeking a way to

Filtering search using multiple dropdowns in MVC gives null Model

我的未来我决定 提交于 2020-12-13 00:37:06
问题 I am currently building an MVC application and I am trying to display a list of cars based on the selected dropdown. I dont want the user to have to select multiple dropdown to search, I want the code to be able to search by any combination of the dropdowns. I started wrinting the code with If else statements but I didnt think this was the best practice so I did some research and found a different way to filter my results. The issue that I am having is that the I am getting a null value in a

Filtering search using multiple dropdowns in MVC gives null Model

不想你离开。 提交于 2020-12-13 00:36:20
问题 I am currently building an MVC application and I am trying to display a list of cars based on the selected dropdown. I dont want the user to have to select multiple dropdown to search, I want the code to be able to search by any combination of the dropdowns. I started wrinting the code with If else statements but I didnt think this was the best practice so I did some research and found a different way to filter my results. The issue that I am having is that the I am getting a null value in a

Connect Entity Framework with MYSQL in VS2019

一世执手 提交于 2020-12-12 11:37:27
问题 I just installed Visual Studio 2019 and I´m trying to add a database with an ADO.NET entity model, but the wizard crashes in this step... Select Entity Framework Version I have Visual Studio Community 2019 v16.4.5 Installed MySQL for Visual Studio 1.2.9 Installed MySQL connector net 8.0.19 I added the references to my project MySQL.data MySQL.data.EntityFramework for EF6 MySQL.web all version 8.0.19, same as the connector I also tried adding from nuget packages EntityFramework MySqlData MySql

Connect Entity Framework with MYSQL in VS2019

强颜欢笑 提交于 2020-12-12 11:35:06
问题 I just installed Visual Studio 2019 and I´m trying to add a database with an ADO.NET entity model, but the wizard crashes in this step... Select Entity Framework Version I have Visual Studio Community 2019 v16.4.5 Installed MySQL for Visual Studio 1.2.9 Installed MySQL connector net 8.0.19 I added the references to my project MySQL.data MySQL.data.EntityFramework for EF6 MySQL.web all version 8.0.19, same as the connector I also tried adding from nuget packages EntityFramework MySqlData MySql

C# Linq Expression could not be Translated

别来无恙 提交于 2020-12-12 03:59:13
问题 I am trying to execute a linq query to get all employes that have some specific skills. search.skills is a list of strings with some skills and I want to retrieve all the user which have all those skills (And condition). In my where clause on employees, exp.Skills is ICollection and expSkill.SkillName is the skill name .Where( emp => search.Skills.All( searchSkill => emp.Experiences.Select(exp => exp.Skills).SelectMany(x => x).Select(expSkill => expSkill.SkillName).Contains(searchSkill) ))

C# Linq Expression could not be Translated

≡放荡痞女 提交于 2020-12-12 03:59:12
问题 I am trying to execute a linq query to get all employes that have some specific skills. search.skills is a list of strings with some skills and I want to retrieve all the user which have all those skills (And condition). In my where clause on employees, exp.Skills is ICollection and expSkill.SkillName is the skill name .Where( emp => search.Skills.All( searchSkill => emp.Experiences.Select(exp => exp.Skills).SelectMany(x => x).Select(expSkill => expSkill.SkillName).Contains(searchSkill) ))

Entity Framework override default property convention to ignore properties

£可爱£侵袭症+ 提交于 2020-12-10 08:45:09
问题 I am rewriting a legacy system to use Entity Framework. The old system had entities where half of the properties were mapped to DB columns and the other half not. To indicate that a property had to be mapped, the property was decorated with a [Field] attribute. All other properties were ignored. This is the opposite of what EF does. By convention, EF maps all public properties with a getter and setter to a DB field unless the property is decorated with [NotMapped] data annotation or Ignore is