private object CreateObject(ITypeSpec spec) { Log.DebugFormat("CreateObject: " + spec); Type type = TypeUtils.GetType(spec.FullName); return(spec.IsViewModel || spec is IServiceSpec || spec.ContainsFacet <INotPersistedFacet>() ? CreateNotPersistedObject(type, spec is IServiceSpec) : objectPersistor.CreateObject(spec)); }
private IOid RestoreGenericOid(string[] encodedData) { string typeName = TypeNameUtils.DecodeTypeName(HttpUtility.UrlDecode(encodedData.First())); ITypeSpec spec = metamodel.GetSpecification(typeName); if (spec.IsCollection) { return(new CollectionMemento(this, nakedObjectManager, metamodel, encodedData)); } if (spec.ContainsFacet <IViewModelFacet>()) { return(new ViewModelOid(metamodel, encodedData)); } return(spec.ContainsFacet <IComplexTypeFacet>() ? new AggregateOid(metamodel, encodedData) : null); }
public INakedObjectAdapter CreateAdapter(object domainObject, IOid oid, IVersion version) { if (domainObject == null) { return(null); } if (oid == null) { ITypeSpec objectSpec = metamodel.GetSpecification(domainObject.GetType()); if (objectSpec.ContainsFacet(typeof(IComplexTypeFacet))) { return(GetAdapterFor(domainObject)); } if (objectSpec.HasNoIdentity) { return(AdapterForNoIdentityObject(domainObject)); } return(AdapterForExistingObject(domainObject, objectSpec)); } return(AdapterForExistingObject(domainObject, oid)); }
public static bool IsFile(this ITypeSpec spec, INakedObjectsFramework framework) { return(spec != null && (spec.IsImage(framework) || spec.IsFileAttachment(framework) || spec.ContainsFacet <IArrayValueFacet <byte> >())); }
public static bool IsBoundedSet(this ITypeSpec spec) { return(spec.ContainsFacet <IBoundedFacet>() || spec.ContainsFacet <IEnumValueFacet>()); }
private object CreateObject(ITypeSpec spec) { Type type = TypeUtils.GetType(spec.FullName); return spec.IsViewModel || spec is IServiceSpec || spec.ContainsFacet<INotPersistedFacet>() ? CreateNotPersistedObject(type, spec is IServiceSpec) : objectPersistor.CreateObject(spec); }