/// <summary>
 ///     Factory (for transient instance)
 /// </summary>
 public INakedObjectAdapter CreateInstance(IObjectSpec spec) {
     if (spec.ContainsFacet(typeof (IComplexTypeFacet))) {
         throw new TransientReferenceException(Log.LogAndReturn(Resources.NakedObjects.NoTransientInline));
     }
     object obj = CreateObject(spec);
     INakedObjectAdapter adapter = nakedObjectManager.CreateInstanceAdapter(obj);
     InitializeNewObject(adapter);
     return adapter;
 }
예제 #2
0
        /// <summary>
        ///     Factory (for transient instance)
        /// </summary>
        public INakedObjectAdapter CreateInstance(IObjectSpec spec)
        {
            if (spec.ContainsFacet(typeof(IComplexTypeFacet)))
            {
                throw new TransientReferenceException(Log.LogAndReturn(Resources.NakedObjects.NoTransientInline));
            }
            object obj = CreateObject(spec);
            INakedObjectAdapter adapter = nakedObjectManager.CreateInstanceAdapter(obj);

            InitializeNewObject(adapter);
            return(adapter);
        }
        /// <summary>
        ///     Factory (for transient instance)
        /// </summary>
        public virtual INakedObject CreateInstance(IObjectSpec spec)
        {
            Log.DebugFormat("CreateInstance of: {0}", spec);
            if (spec.ContainsFacet(typeof(IComplexTypeFacet)))
            {
                throw new TransientReferenceException(Resources.NakedObjects.NoTransientInline);
            }
            object       obj     = CreateObject(spec);
            INakedObject adapter = nakedObjectManager.CreateInstanceAdapter(obj);

            InitializeNewObject(adapter);
            return(adapter);
        }
예제 #4
0
 public static bool IsCollectionOfEnum(this ITypeSpec spec, IObjectSpec elementSpec)
 {
     return(spec.IsCollection && elementSpec.ContainsFacet <IEnumFacet>());
 }
예제 #5
0
 public static bool IsCollectionOfEnum(this ITypeSpec spec, IObjectSpec elementSpec) {
     return spec.IsCollection && elementSpec.ContainsFacet<IEnumFacet>();
 }