开发者

Spring.Net IoC: alternative to using configuration metadata XML

开发者 https://www.devze.com 2022-12-11 10:44 出处:网络
I\'m trying to get a grasp of using spring.net ioc to suit my purpose. What options to using xml configuration (metadata file) are available in spring.net ioc. i.e. i don\'t want to use the following

I'm trying to get a grasp of using spring.net ioc to suit my purpose.

What options to using xml configuration (metadata file) are available in spring.net ioc. i.e. i don't want to use the following:

<object name="MyMovieFinder"
    type="Spring.Examples.MovieFinder.SimpleMovieFinder, 
    Spring.Examples.MovieFinder"/>
</object>

Instead, i want to load this values from a database like below:

   SqlCommand cmd = new SqlCommand("select ObjName, ObjType, ObjPath from tblApp", cn)
   SqlDataReader dr = cmd.ExecuteReader();

while(dr.read)
  IApplicationContext ctx = ContextRegistry.GetContext();
  MovieLister lister = (MovieList开发者_如何学Pythoner) ctx.GetObject (dr["ObjName"]);


If you want to store your object definitions in a database and use that to power your application you should look at the IResource interface, there's a chapter on it in the Spring.NET documentation here.

0

精彩评论

暂无评论...
验证码 换一张
取 消