Exemple #1
0
        public INakedObjectAdapter GetAdapterFor(object obj)
        {
            Assert.AssertNotNull("must have a domain object", obj);
            INakedObjectAdapter nakedObjectAdapter = identityMap.GetAdapterFor(obj);

            if (nakedObjectAdapter != null && nakedObjectAdapter.Object != obj)
            {
                throw new AdapterException(Log.LogAndReturn($"Mapped adapter is for different domain object: {obj}; {nakedObjectAdapter}"));
            }
            return(nakedObjectAdapter);
        }
Exemple #2
0
        public INakedObjectAdapter GetAdapterFor(object obj)
        {
            Log.DebugFormat("GetAdapterFor: {0}", obj);
            Assert.AssertNotNull("must have a domain object", obj);
            INakedObjectAdapter nakedObjectAdapter = identityMap.GetAdapterFor(obj);

            if (nakedObjectAdapter != null && nakedObjectAdapter.Object != obj)
            {
                throw new AdapterException("Mapped adapter is for different domain object: " + obj + "; " + nakedObjectAdapter);
            }
            return(nakedObjectAdapter);
        }
        public INakedObjectAdapter GetAdapterFor(object obj)
        {
            if (obj == null)
            {
                throw new AdapterException(logger.LogAndReturn("must have a domain object"));
            }

            var nakedObjectAdapter = identityMap.GetAdapterFor(obj);

            if (nakedObjectAdapter != null && nakedObjectAdapter.Object != obj)
            {
                throw new AdapterException(logger.LogAndReturn($"Mapped adapter is for different domain object: {obj}; {nakedObjectAdapter}"));
            }

            return(nakedObjectAdapter);
        }