I added a database view for my entity model. Now I'm trying to put an ObjectSet in my ObjectContext so that I can access the view in my application.
For regular tables, my ObjectSet will look like this:
private ObjectSet<StarVendor> _StarVendor; public ObjectSet<StarVendor> StarVendor { get { if ((_StarVendor == null)) { _StarVendor = base.CreateObjectSet<StarVendor>("Stratus_X_TestEntities.StarVendors"); } return _StarVendor; } }
So, I did the same for my view:
private ObjectSet<CatalogItemSearch> _CatalogItemSearch; public ObjectSet<CatalogItemSearch> CatalogItemSearch { get { if ((_CatalogItemSearch == null)) { _CatalogItemSearch = base.CreateObjectSet<CatalogItemSearch>("Stratus_X_TestEntities.CatalogItemSearch"); } return _CatalogItemSearch; } }
But when the code runs, I get an exception:
System.InvalidOperationException "EntitySet Name" Stratus_X_TestEntities.CatalogItemSearch "Not Found"
I know that for presentation I do not need the add / update / delete functions that the ObjectSet provides.
Is there an alternative type of Set that I should use for this?
or can this error come from something completely unrelated to what its appearance is?
thanks
source share