c# - show Method name expected when using StructureMap -


i using structuremap in project using depencyinjection . have 5 project in solution.

i have iunitofwork interface in dal , defnation function of iunitofwork in applicationdbcontext .

applicationdbcontext :

public class applicationdbcontext : dbcontext, iunitofwork {     public applicationdbcontext()         : base("applicationdbcontext")     {     }      public virtual dbset<user> users { get; set; }     public void forcedatabaseinitialize()     {         database.initialize(true);     }      public static applicationdbcontext create()     {         return new applicationdbcontext();     }     #region iunitofwork members      public void markasdeleted<tentity>(tentity entity) tentity : class     {         entry(entity).state = entitystate.deleted;     }     public new idbset<tentity> set<tentity>() tentity : class     {         return base.set<tentity>();     }  . . . 

now when want register iunitofwork in main project :

 public static class structuremapdefnation {     private static readonly lazy<container> _containerbuilder =         new lazy<container>(defaultcontainer, lazythreadsafetymode.executionandpublication);     public static icontainer container     {         { return _containerbuilder.value; }     }     private static container defaultcontainer()     {         var container = new container(ioc =>         {             // map same interface to different concrete classes             ioc.for<iuser>().use<efuserservice>();             ioc.for<iunitofwork>().use(() => new applicationdbcontext())();         });         container.assertconfigurationisvalid();          return container;     } } 

it show me error :

severity code description project file line suppression state error cs0149 method name expected bimehkosarfinal e:\myproject\bimehkosarfinal\bimehkosarfinal\structuremap\structuremapdefnation.cs 28 active

in line :

ioc.for<iunitofwork>().use(() => new applicationdbcontext())(); 

whats problem ? how can solve problem ?

remove last (), , write

ioc.for<iunitofwork>().use(() => new applicationdbcontext()); 

or

ioc.for<iunitofwork>().use<applicationdbcontext>(); 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -