DataConnection.OnEntityCreated not called
See original GitHub issueHi, I’m trying to use OnEntityCreated event. This is my C# code:
private static void Main()
{
DataConnection.DefaultSettings = new MySettings();
Configuration.Sql.GenerateFinalAliases = true;
using var db = new WipDB("Wip");
db.OnEntityCreated += (e) => Console.WriteLine(e.Entity.GetType().Name);
var result = from ncCode in db.NcCode
join ncGroupMember in db.NcGroupMember
on ncCode.Handle equals ncGroupMember.NcCodeOrGroupGbo
where
ncGroupMember.NcGroupBo == "NCGroupBO:" + ncCode.Site + ",CATAN_AUTO" ||
ncGroupMember.NcGroupBo == "NCGroupBO:" + ncCode.Site + ",CATAN_MAN" ||
ncGroupMember.NcGroupBo == "NCGroupBO:" + ncCode.Site + ",CATAN_ALL"
select new AllowedNcCodeOutput { NcCodeBo = ncCode.Handle, NcCode = ncCode.NcCodeColumn, NcCodeDescription = ncCode.Description };
var sql = result.ToString();
Console.WriteLine(sql);
var resultItems = result.ToList();
}
The issue is that Console.WriteLine(e.Entity.GetType().Name
is never called even if result.ToList() contains more than 7000 items.
I’m expecting that OnEntityCreated will be raised for each entity of type AllowedNcCodeOutput that is created by the query. Am I wrong?
Thank you!
Environment details
inq2db version: 3.0.0-rc.2303 Database Server: Oracle Database Provider: Oracle.ManagedDataAccess.Core (3.0.0-rc.2303) Operating system: Windows 10 .NET Framework:.NET Core 3.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
DataConnection.OnEntityCreated not called with LoadWith
OnEntityCreated is not called for the entities of the subquery. The reason seems to be that the DataConnection is cloned for subqueries but ......
Read more >Newest 'connection' Questions - Page 32
typeORM combine next.js can not connect database with error ... I am implementing a calling app and I want to do a self-managed ......
Read more >TMS Aurelius Manual
object. If the very Next call returns false, it means the cursor has no records. 85<br />. <strong>TMS</ ...
Read more >Diving Into Microsoft Net Entity Framework | PDF
This does not require a developer to have an intense knowledge of database or its schema. This innovation was named as. Entity Framework...
Read more >TMS Aurelius Manual - TMS Software - manualzz.com
You do that by adding a unit named Aurelius.SQL.XXX (where XXX is the name of SQL dialect) to any unit of your application,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, You give me better idea:
Thank you for let me find a different way to solve my issue: IQueryable inherits IEnumerable and I can change the entities one by one using yield keyword. I want to avoid to allocate all entities in a list using ToList() before memory compression. The only drawback is that I need to change every query instead to implement a single event. Please feel free to close this issue if you want.
Thank you