Beispiel #1
0
 public PersonController(
     ITypeAdapterFactory adapterFactory,
     IPersonService personService
     )
 {
     _adapter       = adapterFactory.Create();
     _personService = personService;
 }
        /// <summary>
        /// Create a new type adapter from currect factory
        /// </summary>
        /// <returns>Created type adapter</returns>
        public static ITypeAdapter CreateAdapter()
        {
            if (currentTypeAdapterFactory == null)
            {
                throw new InvalidOperationException("No current type adapter factory available.");
            }

            return(currentTypeAdapterFactory.Create());
        }
        /// <summary>
        /// Create a new type adapter from currect factory
        /// </summary>
        /// <returns>Created type adapter</returns>
        public static ITypeAdapter CreateAdapter()
        {
            if (currentAdapter == null)
            {
                currentAdapter = currentTypeAdapterFactory.Create();
            }

            return(currentAdapter);
        }
Beispiel #4
0
        /// <summary>
        /// Create a new type adapter from current factory
        /// </summary>
        /// <returns>Created type adapter</returns>
        public static ITypeAdapter Create()
        {
            if (_currentTypeAdapterFactory == null)
            {
                throw new ArgumentNullException(nameof(_currentTypeAdapterFactory));
            }

            return(_currentTypeAdapterFactory.Create());
        }
Beispiel #5
0
        public static ITypeAdapter Create()
        {
            if (currentTypeAdapterFactory == null)
            {
                throw new NullReferenceException("Uma instância de ITypeAdapterFactory deve ser fornecida através do método SetCurrent(ITypeAdapterFactory typeAdapterFactory).");
            }

            return(currentTypeAdapterFactory.Create());
        }
Beispiel #6
0
        /// <summary>
        /// Create a new type adapter from currect factory
        /// </summary>
        /// <returns>Created type adapter</returns>
        public static ITypeAdapter CreateAdapter()
        {
            if (_currentTypeAdapterFactory == null)
            {
                lock (lock_flag)
                {
                    if (_currentTypeAdapterFactory == null)
                    {
                        _currentTypeAdapterFactory = ObjectContainer.CreateInstance <ITypeAdapterFactory>();
                    }
                }
            }

            return(_currentTypeAdapterFactory.Create());
        }
Beispiel #7
0
 /// <summary>
 /// Create a new type adapter from currect factory
 /// </summary>
 /// <returns>Created type adapter</returns>
 public static ITypeAdapter CreateAdapter()
 {
     return(_currentTypeAdapterFactory.Create());
 }
 public static ITypeAdapter CreateAdapter()
 {
     return((_currentTypeAdapterFactory != null) ? _currentTypeAdapterFactory.Create() : null);
 }
Beispiel #9
0
 public static ITypeAdapter Create()
 {
     return(_factory.Create());
 }