首页 新闻 赞助 找找看

Spring.Net这样注入的写法是否可以

0
悬赏园豆:30 [已关闭问题] 关闭于 2012-02-03 10:47

Spring.Net这样注入的写法是否可以:

 

        private static Spring.Context.IApplicationContext _application;
        private static Spring.Context.IApplicationContext ApplicationContext
        {
            get
            {
                if (_application == null)
                {
                    _application = Spring.Context.Support.ContextRegistry.GetContext();
                }
                return _application;
            }
        }

 

  public static T GetObject<T>(string code)
        {
            return GetObject<T>(code, null);
        }


        public static object GetObject(string code, object[] objs)
        {
            return ApplicationContext.GetObject(code, objs);
        }       

///////////////////////////调用/////////////////////////////

 private  INews _news = null;
        private  INews BizNews
        {
            get
            {
                if (_news == null)
                {
                    _news = GetObject<INews>("Biz.News");
                }

                return _news;
            }
        }

 

、、、、、、、、、、、、、、、、、、、、、、

这是运行后报的错误:

youdesou的主页 youdesou | 初学一级 | 园豆:173
提问于:2011-12-27 23:19
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册