Hi,
Just for the sake of sharing, it is important to point out that there are two functions for creating Entity and EntityCollection from EntityType without having to have either created first; in other words you don't need Entity for creating EntityCollection or vice-versa. For example:
GeneralEntityFactory.Create(entityType)
is to create a single entity, and...
GeneralEntityCollectionFactory.Create(entityType)
is to create a collection, thus, Walaa's code can be further enhanced to be...
private IEntityCollection GetCollection(string entityName)
{
var entityType = (EntityType)Enum.Parse(typeof(EntityType), entityName, false);
//var myEntity = GeneralEntityFactory.Create(entityType);
//var entityfactory = myEntity.GetEntityFactory();
var collection = GeneralEntityCollectionFactory.Create(entityType);
collection.GetMulti(null);
return collection;
}
Lovely code, IMHO.