Q: In our application, there is a new entity “Address” as well as table “Address” added. When try to access its DAL, we are getting error below.
Unable to cast object of type 'CelloSaaS.SqlDAL.MasterData.AddressDAL' to type 'Application.Common.DAL.IAddressDAL'. We have also tried adding to unity.config. But still same issue occurs.
This is blocking issue and Due to this we are unable to proceed further. This is because there is already “Address” table available in CelloSaaS. We may use another name like ApplicationAddress. But it doesn’t make sense. So we like to use the same name.
A: This is due to duplicates name of 2 different objects, i.e CelloSaaS already contains an object with the same name, So when you add another object with the same name, this may arise. In order to avoid this, remove or comment out the below configuration lines from unity.config located under the Web project.
<typeAlias alias="IAddressDAL" type="CelloSaaS.DAL.MasterData.IAddressDAL, CelloSaaS.DAL" />
Note: The above solution will be applicable for all CelloSaaS related entities.