c# - StructureMap 'conditional singleton' for Lucene.Net IndexReader -


i have threadsafe object expensive create , needs available through application (a lucene.net indexreader).

the object can become invalid, @ point need recreate (indexreader.iscurrent false, need new instance using indexreader.reopen).

i'd able use ioc container (structuremap) manage creation of object, can't work out if scenario possible. feels kind of "conditional singleton" lifecycle.

does structuremap provide such feature? alternative suggestions?

i use scope of perrequest , not return indexreader directly. instead, i'd return abstraction of indexreader perform check on static reference held on class level.

then, when property on shim/proxy/abstraction accessed, check static reference (you make thread-safe, of course) , re-get indexreader if needed before delivering user.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -