Exemplo n.º 1
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);
        }