Beispiel #1
0
        /// <summary>
        /// Register the instance of type t.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="instance"></param>
        public static void Register <T>(Func <T> fetcher) where T : class
        {
            var meta = new InstanceMetaData();

            meta.IsSingleton     = false;
            meta.Fetcher         = fetcher;
            _services[typeof(T)] = meta;
        }
Beispiel #2
0
        /// <summary>
        /// Register the instance of type t.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="instance"></param>
        public static void Register <T>(T instance) where T : class
        {
            var meta = new InstanceMetaData();

            meta.Instance        = instance;
            meta.IsSingleton     = true;
            _services[typeof(T)] = meta;
        }