Пример #1
0
 internal StoreService(string name, IPurchasingModule purchasingModule, IStoreDelegate storeDelegate)
 {
     _serviceName      = string.IsNullOrEmpty(name) ? "Purchasing" : "Purchasing." + name;
     _console          = new TraceSource(_serviceName, SourceLevels.All);
     _delegate         = storeDelegate;
     _purchasingModule = purchasingModule;
 }
Пример #2
0
        /// <summary>
        /// Creates a new <see cref="IStoreService"/> instance.
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="purchasingModule"/> or <paramref name="storeDelegate"/> is <c>null</c>.</exception>
        /// <exception cref="InvalidOperationException">Thrown if an instance of <see cref="IStoreService"/> already exists.</exception>
        public static IStoreService CreateStore(IPurchasingModule purchasingModule, IStoreDelegate storeDelegate)
        {
            if (purchasingModule == null)
            {
                throw new ArgumentNullException(nameof(purchasingModule));
            }

            if (storeDelegate == null)
            {
                throw new ArgumentNullException(nameof(storeDelegate));
            }

            return(new StoreService(string.Empty, purchasingModule, storeDelegate));
        }