static public ParseSinglePropertySequenceValueIntoHvos ( string singlePropertySequenceValue, SIL.FieldWorks.FDO.FdoCache cacheForCheckingValidity, int expectedClassId ) : List |
||
singlePropertySequenceValue | string | |
cacheForCheckingValidity | SIL.FieldWorks.FDO.FdoCache | null, if you don't care about checking the validity of the items in singlePropertySequenceValue, /// otherwise, pass in a cache to check validity. |
expectedClassId | int | if you pass a cache, you can also use this too make sure the object matches an expected class, /// otherwise it just checks that the object exists in the database (or is a valid virtual object) |
return | List |
static public List<int> ParseSinglePropertySequenceValueIntoHvos(string singlePropertySequenceValue,
FdoCache cacheForCheckingValidity, int expectedClassId)
{
var hvos = new List<int>();
if (String.IsNullOrEmpty(singlePropertySequenceValue))
return hvos;
FdoCache cache = cacheForCheckingValidity;
foreach (string sHvo in ChoiceGroup.DecodeSinglePropertySequenceValue(singlePropertySequenceValue))
{
int hvo;
if (Int32.TryParse(sHvo, out hvo))
{
if (cache != null)
{
try
{
var obj = cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
}
catch
{
continue;
}
}
hvos.Add(hvo);
}
}
return hvos;
}