I have a requirement to load the lookup table data for order contacts and order contact people.
Once I determine the Lookup Table name, I have been able to successfully load the lookup table data that I need given the tablename and the lookupcode, however I have a question about figuring out the correct lookup table name in the first place.
I have been able to iterate through the collection of contacts (and contact persons) in IOrder and execute the following code for each:
Code: Select all
string lookupTableName;
Type contactType = spsContact.GetType();
ILookupMap map = lookups.GetLookupMap(profileInfo);
const string overlayPath = ".LookupCode";
if (map.Contains(contactType, overlayPath))
{
ILookupMapEntry mapEntry = map[contactType, overlayPath];
lookupTableName = mapEntry.Name;
}
This *will* successfully load the lookuptable name, however in my use case I am loading the lookup table data "out of band" and do not have the object availabe to call .GetType() on.
I only have the string representation of ContactType (spsContact.ContactType.ToString()) ie "Government"
ILookupMap will only accept "Type" for OverlayContext
Code: Select all
public interface ILookupMap
{
ILookupMapEntry this[Type overlayContext, string overlayPath] { get; }
bool Contains(Type overlayContext, string overlayPath);
bool TryGet(Type overlayContext, string overlayPath, out ILookupMapEntry entry);
}
Code: Select all
List<ILookupTableInfo> tables = lookups.Tables
.Where(t =>
t.OverlayContext == "Government" &&
t.OverlayPath == ".LookupCode")
.HavingProfile(profileInfo)
.ToList();
However, in my testing, including any version of Having Profile:
.HavingProfile(Guid)
.HavingProfile(IProfileInfo)
.HavingProfiles(IList<IProfileInfo>)
will result in zero results for the query.
Removing .HavingProfile returns a resultset that seems to span all profiles.
When I pass the same IProfileInfo object in the code above to .GetLookupMap() it will result in the correct data being loaded.
Are the .HavingProfile(s) extension methods supposed to work in the above example?
Is there a different interface available where I can can pass in the "OverlayContext" as a string, rather than the object Type?
Thanks in advance,
Max Schilling
FNF FSI Team