Add or remove Related Entity Locator

Aug 25, 2011 at 6:19 PM

Hi, I read this article and I agreed with the writer.

http://www.ladislavmrnka.com/2011/05/foreign-key-vs-independent-associations-in-ef-4/

 

The question is, I would like to use independent association as an related entity, I already developed it, but now I'm having some problems to upgrade the scaffolding and mantain my changes, so my idea is to be able to attach or remove the locators in the t4 scaffolding

this code get all the relations that doesn't have an foreign key property.

var pks = PrimaryKeyLocation.GetPrimaryKeys(property.Type.CodeType);
				if (pks.Count() > 0)
				{	
					if (!allCandidateProperties.Any(p => p.Name.Equals(property.Name + PropertySuffix, StringComparison.OrdinalIgnoreCase)))
					{
						return new RelatedEntityInfo(RelationType.Parent, property.Name, property, property.Type.CodeType, pks.Single().Name, property);
					}
				}
My idea is to do almost as it's done with primary key locator, but instead of static reference to all locators , could it have some config file or in the init.ps to add the desired locators to the locatorService?
is this possible?