RegisterItemCollection(new ObjectItemCollection()) required?
- I was wondering if registeritemcollection with new ObjectItemCollection is required or not and what purpose does it serve. I read my ssdl,msl and csdl from the database and create metadataworkspace.var edmcollection = new EdmItemCollection(new XmlReader[] { csdlreader });var ssdlcollection = new StoreItemCollection(new XmlReader[] { ssdlreader });var mappingcollection = new StorageMappingItemCollection(edmcollection, ssdlcollection,new XmlReader[] { mslreader });workspace.RegisterItemCollection(edmcollection);workspace.RegisterItemCollection(ssdlcollection);workspace.RegisterItemCollection(mappingcollection);workspace.RegisterItemCollection(new ObjectItemCollection());//not requiredhowever i have seen some places on the web, where ObjectItemCollection was also registered. but when i remove that line it still works. I am reading the edmx info from the database with my POCO classes.Zeeshan
Answers
Zeeshan,
The ObjectItemCollection is only required to be registered if you are using the MetadataWorkspace in a scenario where you will use the object layer i.e. the ObjectContext. However if you simply want to use the MetadataWorkspace with the EntityConnection (all conceptual layer), there is no need to register an ObjectItemCollection.
We have been considering the addition of configurable conceptual to object layer mapping. If added, it won’t show up till post .NET 4.0. Do you have scenarios in mind that we should consider for configurable conceptual to object layer mapping?
Thanks,
-jeff- Marked As Answer byDiego B VegaMSFT, ModeratorTuesday, November 17, 2009 12:49 AM
- Note also that the ObjectContext will register an ObjectItemCollection for you if you construct it from an EntityConnection.
Thanks,
-jeff- Marked As Answer byDiego B VegaMSFT, ModeratorTuesday, November 17, 2009 12:49 AM
All Replies
- I have one more question related to the above question. Is there a one to one mapping between conceptual model and object model? If that is true, is that something that will change in the future?Zeeshan
Zeeshan,
The ObjectItemCollection is only required to be registered if you are using the MetadataWorkspace in a scenario where you will use the object layer i.e. the ObjectContext. However if you simply want to use the MetadataWorkspace with the EntityConnection (all conceptual layer), there is no need to register an ObjectItemCollection.
We have been considering the addition of configurable conceptual to object layer mapping. If added, it won’t show up till post .NET 4.0. Do you have scenarios in mind that we should consider for configurable conceptual to object layer mapping?
Thanks,
-jeff- Marked As Answer byDiego B VegaMSFT, ModeratorTuesday, November 17, 2009 12:49 AM
- Note also that the ObjectContext will register an ObjectItemCollection for you if you construct it from an EntityConnection.
Thanks,
-jeff- Marked As Answer byDiego B VegaMSFT, ModeratorTuesday, November 17, 2009 12:49 AM

