I have following 2 classes. public partial class Query { public int Id { get; set; } public virtual QueryGroup QueryGroup { get; set; } } public partial class QueryGroup { public int Id {…
Tag: entity-framework-core
Sql Server Float to C# double adding trailing zeros
I have a float column in SQL Server with value 21.261 , when I am fetching this column into c# double , using entity framework core 2.0 it is becoming 21.2610000000042, how to avoid this and get the …
How to write Inline If Statement(SQL IIF) in EFCore Select?
I have the following Customer table: Id First Last LocationId 0 John Doe 2 1 Mary Smith 4 My use case requires column level permissions(predicated on a value in the Entity’s …
DbContext.DbSet.FromSql() not accepting parameters
I have a database with two tables, and wrote a relatively simple select statement that combines the data and returns me the fields I want. In my SQL developer software it executes just fine. Now to …
SqlClient.SqlException: Invalid column name ClassNameId While fetching data from Fluent API
I am new to this EF,I am tring to fetch data from Sql Db table, and it gives me error like invalid classNameId error. public class ClassName { [Key] [Display(Name = “Id:”)] …
Execute SQL command in Entity Framework Core 2.0 to delete all data in a table
I want to execute an SQL command from Entity Framework Core 2.0, but I can’t figure out how to do so. 1.- The reason why I need to, is that I want to delete all data from a database table, and using Context.remove or Context.removeRange would produce many calls to DB (one for each data in the table). 2.- I’ve