public object GetDomainObjectByOid(IOidTranslation objectId) { Type type = ValidateObjectId(objectId); string[] keys = GetKeys(objectId.InstanceId, type); NakedObjectSpecification spec = [email protected]().loadSpecification(type.FullName); NakedObject pattern = [email protected]().createTransientInstance(spec); PropertyInfo p = pattern.getObject().GetType().GetProperty("Id"); ((WholeNumber) p.GetValue(pattern.getObject(), null)).setValue(int.Parse(keys.First())); var criteria = new TitleCriteria(spec, pattern.titleString(), false); TypedNakedCollection results = [email protected]().findInstances(criteria); if (results.size() == 0) { throw new ObjectResourceNotFoundNOSException(objectId.ToString()); } return results.elementAt(0).getObject(); }
public object GetDomainObjectByOid(IOidTranslation objectId) { Type type = ValidateObjectId(objectId); string[] keys = GetKeys(objectId.InstanceId, type); NakedObjectSpecification spec = [email protected]().loadSpecification(type.FullName); NakedObject pattern = [email protected]().createTransientInstance(spec); PropertyInfo p = pattern.getObject().GetType().GetProperty("Id"); ((WholeNumber)p.GetValue(pattern.getObject(), null)).setValue(int.Parse(keys.First())); var criteria = new TitleCriteria(spec, pattern.titleString(), false); TypedNakedCollection results = [email protected]().findInstances(criteria); if (results.size() == 0) { throw new ObjectResourceNotFoundNOSException(objectId.ToString()); } return(results.elementAt(0).getObject()); }
protected static Type ValidateObjectId(IOidTranslation objectId) { return ValidateId(objectId, () => { throw new ObjectResourceNotFoundNOSException(objectId.ToString()); }); }
protected static Type ValidateObjectId(IOidTranslation objectId) { return(ValidateId(objectId, () => { throw new ObjectResourceNotFoundNOSException(objectId.ToString()); })); }