I want to create a read-only property [NotMapped]Database {get;} on a POCO entity class to reflect the name of the database from which the entity was loaded at the time of creation so that I can read the value later when no DbContext instance is available. How do I tell EF to load this data at object creation time?
I know about context.Database.Connection.ConnectionString, but that is not what I want to do. I want to set the property to the current database name when the object is being instantiated via a DbContext class.
I have searched for this problem but haven't been able to find any information to provide here, perhaps I don't know how to phrase the question.