Beispiel #1
0
        //第一种方式
        //public ValuesController(Func<string, IJK> serviceAccessor)
        //{
        //    this._serviceAccessor = serviceAccessor;
        //    _serviceA = _serviceAccessor("JK1");
        //    _serviceB = _serviceAccessor("JK2");

        //}

        //第二种方式
        public ValuesController(IEnumerable <IJK> svs)
        {
            foreach (var sv in svs)
            {
                if (sv is JK1)
                {
                    _serviceA = sv;
                }
                if (sv is JK2)
                {
                    _serviceB = sv;
                }
            }
        }
Beispiel #2
0
 public ValuesController(Func <string, IJK> serviceAccessor)
 {
     this._serviceAccessor = serviceAccessor;
     _serviceA             = _serviceAccessor("JK1");
     _serviceB             = _serviceAccessor("JK2");
 }