Hi Guys,
After reading Otis's post on OMR performance I downloaded LLBLGenProfiler. Should have
done it way sooner!!
I'm using subtyping successfully but in many valid cases there is a need to get just the data for the super type entity without the mad left joins to the subtypes and caring about any inheritance.
#region -- method 1
GameInstanceEntity g = new GameInstanceEntity(new Guid("702D6644-456E-DF11-94A4-08002700DCE4"));
da.FetchEntity(g);
#endregion
#region -- method 2
EntityCollection<GameInstanceEntity> baseItems = new EntityCollection<GameInstanceEntity>(new GameInstanceEntityFactory());
IEntityFields2 fields = baseItems.EntityFactoryToUse.CreateFields();
List<IDataValueProjector> valueProjectors = new List<IDataValueProjector>();
for (int i = 0; i < fields.Count; i++)
{
IEntityField2 field = fields[i];
valueProjectors.Add(new DataValueProjector(field.Name, i, field.DataType));
}
RelationPredicateBucket filter = new RelationPredicateBucket(GameInstanceFields.GameInstanceId == new Guid("702D6644-456E-DF11-94A4-08002700DCE4"));
DataProjectorToIEntityCollection2 projector = new DataProjectorToIEntityCollection2(baseItems);
da.FetchProjection(valueProjectors, projector, fields, filter, 0, true);
#endregion
method 1 produces sql that left joins to 18 tables!
method 2 produces sql that just fetches the gameinstance entity with no joins to subtypes.
Surely there must be a simpler way to perform method 2 in syntax similar to method 1?
Please please!!!
I'm on version 2.6 and this would be a great reason to move to 3
Many thanks