NET Developers
We had a .net core 2.2 HR management project was working fine and stable, after we took the step to upgrade it into .Net core 6, we’ve faced an issue with the entity framework.
We have two classes called (JobInfo) one is from outsource package, and the other one developed inside the HR project which inherits from the outsourced one, the same applies for another class with name Employee (2 classes as well, 1 outsource and 1 inside HR).
This is the insourced class
(https://i.sstatic.net/2fej6LCM.png)
As we see it inherits from the Company.Core.Domains.JobInfo
(https://i.sstatic.net/CdYCmBrk.png)
And this is the outsourced class.
So,
(https://i.sstatic.net/IhVQiRWk.png)
In the image above in this Query it Executes without any issues but when I looked for the attributes, I found the following:
(https://i.sstatic.net/rUAydEHk.png)
As we see, there are two attributes for JobInfo one for the out source package (NanoSoft.Company.Core.Domains) and the other JobInfo class this is an issue,
the main Issue which causes us to discover this issue is here
(https://i.sstatic.net/vyMRLo7C.png)
When we tried to Include the Shift (note: shift is a property which is defined in the insource HR project Job Info class only)
When we tried to execute this is the main issue we faced:
(https://i.sstatic.net/iVt8wdnj.png)
We got this Exception which says:
The expression ‘s.Shift’ is invalid inside an ‘Include’ operation, since it does not represent a property access: ‘t => t.MyProperty’. To target navigations declared on derived types, use casting (‘t => ((Derived)t).MyProperty’) or the ‘as’ operator (‘t => (t as Derived).MyProperty’). Collection navigation access can be filtered by composing Where, OrderBy(Descending), ThenBy(Descending), Skip or Take operations.
Seems like he is looking for the Shift in the outsource JobInfo class.
So, we’re looking for someone who is very expertized in .net core 6 Entity framework.
The same code works fine with .NET 2 but not .NET6, we tried to install DAPPER and it can access the shift from the insource Class.
Mohamed Shlibek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.