Ümit Akbaş
2015-11-24 09:53:25 UTC
Hi , first of all it is nice work. !! Thank you.
I have a question about binsor to optimize register components text format
in boo files.
I want to use this code block in my boo files :
"var kernel = new DefaultKernel();
*using (kernel.OptimizeDependencyResolution())*{
for (int i = 0; i < 500; i++)
{
kernel.AddComponent("key" + i, typeof(string), typeof(string));
}
}
"
below you can see my boo code.
"private def RegisterRepositories():
for type in AllTypes("<myAssebmly>"):
continue unless typeof(cr.IRepositoryBase).IsAssignableFrom(type)
keyType = TypeHelper.GetTopLevelRepositoryInterface(type)
if not Kernel.HasComponent(keyType):
Component type.Namespace + "." + type.Name.ToLowerInvariant() +
".repository", keyType, type
"
how can i you "using" c# keyword in my case.
i'll be happy with your helps.
Thanx...
Ãmit
I have a question about binsor to optimize register components text format
in boo files.
I want to use this code block in my boo files :
"var kernel = new DefaultKernel();
*using (kernel.OptimizeDependencyResolution())*{
for (int i = 0; i < 500; i++)
{
kernel.AddComponent("key" + i, typeof(string), typeof(string));
}
}
"
below you can see my boo code.
"private def RegisterRepositories():
for type in AllTypes("<myAssebmly>"):
continue unless typeof(cr.IRepositoryBase).IsAssignableFrom(type)
keyType = TypeHelper.GetTopLevelRepositoryInterface(type)
if not Kernel.HasComponent(keyType):
Component type.Namespace + "." + type.Name.ToLowerInvariant() +
".repository", keyType, type
"
how can i you "using" c# keyword in my case.
i'll be happy with your helps.
Thanx...
Ãmit
This is really cool. Awesome work.
The recent changes to the kernel registration interface allows for custom
registration strategies. I just added an AllTypesOf strategy to allow
forregistration strategies. I just added an AllTypesOf strategy to allow
the most common scenarios.
Here are some examples
registering all controllers in the current assembly
kernel.Register( AllTypesOf<IController>
.FromAssembly( Assembly.GetExecutingAssembly() )
);
selecting the first interface as the service
kernel.Register( AllTypesOf<ICommon>
.FromAssembly(Assembly.GetExecutingAssembly() )
.WithService.FirstInterface()
);
Using custom configuration
kernel.Register( AllTypesOf<ICommon>
.FromAssembly( Assembly.GetExecutingAssembly() )
.Configure( component => component.LifeStyle.Transient
.Named(
component.Implementation.FullName + "XYZ" )
)
);
Choosing types if they have a specific attribute (courtesy of LINQ)
kernel.Register( AllTypesOf<CustomerChain1>
.Pick( from type in
Assembly.GetExecutingAssembly().GetExportedTypes()
where type.IsDefined(typeof(SerializableAttribute),
true)Here are some examples
registering all controllers in the current assembly
kernel.Register( AllTypesOf<IController>
.FromAssembly( Assembly.GetExecutingAssembly() )
);
selecting the first interface as the service
kernel.Register( AllTypesOf<ICommon>
.FromAssembly(Assembly.GetExecutingAssembly() )
.WithService.FirstInterface()
);
Using custom configuration
kernel.Register( AllTypesOf<ICommon>
.FromAssembly( Assembly.GetExecutingAssembly() )
.Configure( component => component.LifeStyle.Transient
.Named(
component.Implementation.FullName + "XYZ" )
)
);
Choosing types if they have a specific attribute (courtesy of LINQ)
kernel.Register( AllTypesOf<CustomerChain1>
.Pick( from type in
Assembly.GetExecutingAssembly().GetExportedTypes()
where type.IsDefined(typeof(SerializableAttribute),
select type
));Thanks to Ayende for inspiration from some of his
Binsor));Thanks to Ayende for inspiration from some of his
work!!!
craig
craig
--
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to castle-project-devel+***@googlegroups.com.
To post to this group, send email to castle-project-***@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-devel.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Castle Project Development List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to castle-project-devel+***@googlegroups.com.
To post to this group, send email to castle-project-***@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-devel.
For more options, visit https://groups.google.com/d/optout.