Fetching logs efficiently
I have a simple log table where I store things like what, who and when:public class Logg { public int ID { get; set; } public string Name { get; set; } public string What { get; set; } public DateTime...
View ArticleDo you think this tutorial is wrong or outdated
Hello,I'm learning the Entity framework core and encountered in this tutorial:You can see the page here:https://entityframeworkcore.com/querying-data-basic-queryAnd in there comes:Let's say we have a...
View Articlehow to include newline character in automapper?
hi, I'm using automapper to update fields in a database. After the database is updated, the data can be viewed via web application. I have one field that contains data for three items. I would like...
View ArticleGet list of primary key column names in EF Core
ASP.NET MVC Core application using EF Core. In linq to sql this code returns list of database table primary key columns names: /// <summary> /// Database primary key names /// </summary>...
View ArticleHow to create DbContext at runtime
ASP.NET 5 MVC Core application uses databases whose table columns are slightly different. Npgsql EF Core provider is used. How to create DbContext at runtime ? If dependency injection requires...
View ArticlePrevent SQL Injection
I have this simple query executed in custom control.SELECT StateID, StateName FROM State WHERE IsEnabled = 'TRUE' ORDER BY StateNameHow can I prevent SQL Injection form this code?
View ArticleOne-to-many projection in a Web API NET5.0 controller - how to do it?
I set out to create a controller to retrieve Transaction properties for display purposes later on.A single Txn has all the typical properties you would expect such as a TDate, IsPaid, the initials of...
View ArticleScaffold in runtime
Tried to implement runtime scaffolding as described inhttps://medium.com/@zaikinsr/roslyn-ef-core-runtime-dbcontext-constructing-285a9d67bc87In project .config file<PackageReference...
View ArticleHow to use EF Core pluralizer in runtime scaffold
Tried to use runtime scaffold in EF Core with NpgSql EF ProviderCreated scaffolder as described in https://github.com/jdtcn/RuntimeEfCore : using Microsoft.CodeAnalysis; using...
View ArticleHow to use new version of DbContext assembly after old version is loaded
Entity Framework Core NpgSql MVC application uses Scaffolded DbContext to access data.DbContext is stored in separate assembly containing only this type.If database structure is changed , new...
View ArticleMaking EF Core properties backward compatible with Linq-To-Sql
ASP. NET MVC 4.8 application uses DbLinq. Database has tables where column and table names are same: CREATE TABLE Product ( Product CHAR(20) PRIMARY KEY ); Sql to Linq created entites with Contents...
View Articleinsert for many to many relation in entity framework
hi team.i am unable to insert the many to many relation useingnavigation property for 2 table..if i have 2 table like student and hobbies.studenthobbies contain primaray key of 2 table.how can i insert...
View Article[EF Core / DbContext] If I .Add() a row in a seperate thread, related...
Just to make it clear:I use an injected instance of DbContext when it runs outside the thread, and a new DbContext() inside the thread.Whether I run the code in a seperate thread or not, the...
View ArticleSelect one recent row for that record with group by two columns
I want to select the newest record ordering by RequestDate if that has the RoomStatus as Request having the same id RoomId and RequesterId.I have written the following query but this doesn't help to...
View ArticleNuget restores design elements when upgrading EF Core from 5.0.2 to 5.0.3
After upgrading EF Core packages from 5.0.2 to 5.0.3 runtime scaffold usinghttps://github.com/jdtcn/RuntimeEfCore is broken.The following namespaces do not exist anymore:``` using...
View ArticleUsing EF as scoped service throws exception "A command is already in progress"
Using Npgsql EF data provider as scoped service throws exception.To reproduce:1. Configure ASP.NET 5 MVC Core application to use NpgSql EF provider as scoped service in StartUp.cs :> public void...
View ArticleError while trying to update database for sqlcachedependency.
I keep receiving the following messsage from the command prompt while trying to update database for sqlcachedependency.What should I do? Where is the mistake? I'm following this...
View ArticleNot databound? Databinding methods such as Eval(), XPath(), and Bind() can...
I can't seem to get a simple .NET application to recognize a databound control. Basically I have a .NET application, this time in Visual Basic, with an Entity build from an existing database. When I...
View ArticleWriting Parent and Child data at the same time.
Morning,Hope someone can help with with this. I have two models: public class Parent { public int ParentID { get; set; } public string Data { get; set; } public virtual ICollection<Child>...
View ArticleTrim trailing spaces from retrieved strings in EF Core
ASP.NET MVC Core 5 application uses Npgsql Entity Framework Core Data Provider to get data from Postgres database using Entity Framework Core. Columns in database are defined as CHAR(n) type, like...
View Article