spring.net

Is there any way to use SCOPE_IDENTITY if using a multiple insert statement?

女生的网名这么多〃 提交于 2019-12-21 07:07:00
问题 I will import many data rows from a csv file into a SQL Server database (through a web application). I need the auto generated id value back for the client. If I do this in a loop, the performance is very bad (but I can use SCOPE_IDENTITY() without any problems). A more performant solution would be a way like this: INSERT INTO [MyTable] VALUES ('1'), ('2'), ('3') SELECT SCOPE_IDENTITY() Is there any way to get all generated IDs and not only the last generated id? Thanks for your help! Best

.net assemblies and individual configuration

此生再无相见时 提交于 2019-12-20 07:32:16
问题 My primary assembly is a web application. It uses spring.net framework to load other assemblies into its executing app domain. So naturally this means all those other assemblies must get their config values (for e.g. connection strings & app settings) from the web.config. Is there a way I can override this? Some of the configurations can come from the web.config; others must reside separately. What kind of an approach should I take in developing such .net assemblies? The goal is, once this

How to configure RetryAdvice and ExceptionTranslation for Deadlocks using NHibernate and Spring

时光怂恿深爱的人放手 提交于 2019-12-19 03:22:32
问题 i am using Spring.net 1.2 with NHibernate 2.0.1. Within my project i'am facing some Deadlock issues and besides the database tweaks to minimize the occurence i would like to implement Springs RetryAdvice to handle this. I can't find any working example how to configure a this. The reference seems to be clear about how to use it but somehow i can't get it working. <!--Used to translate NHibernate exception to Spring.DataAccessExceptions--> <object type="Spring.Dao.Attributes

How to configure RetryAdvice and ExceptionTranslation for Deadlocks using NHibernate and Spring

老子叫甜甜 提交于 2019-12-19 03:22:08
问题 i am using Spring.net 1.2 with NHibernate 2.0.1. Within my project i'am facing some Deadlock issues and besides the database tweaks to minimize the occurence i would like to implement Springs RetryAdvice to handle this. I can't find any working example how to configure a this. The reference seems to be clear about how to use it but somehow i can't get it working. <!--Used to translate NHibernate exception to Spring.DataAccessExceptions--> <object type="Spring.Dao.Attributes

IoC, AOP and more

本秂侑毒 提交于 2019-12-18 11:58:01
问题 What is an IoC container? What is an IoC/DI framework? Why do we need a framework for IoC/DI? Is there any relationship between IoC/DI and AOP? What is Spring.net/ninject with respect to IoC and AOP? 回答1: JMSA, James Kovacs wrote a fantastic article which covers many of your questions I would recommend reading it Here Spring.Net, Ninject, Unity, Castle Windsor, Autofac are all IOC containers which are configurable in different ways, many of them do also support AOP. Frameworks for IOC/DI are

How to inject Predicate and Func in Spring.net

元气小坏坏 提交于 2019-12-18 06:59:49
问题 I want to create an object with a constructor containing predicate and func objects in the xml config using spring. The Predicate and the Func arguments should point to a method of another configured object. How is this possible using Spring.net? I was not able to find a solution or hint in the documentation... A sample constructor would be: MyClass(Predicate<TInput> condition, Func<TInput, TOutput> result) 回答1: It is also possible to use the DelegateFactoryObject within Spring.net to create

Unobtrusive AOP with Spring.Net

不羁的心 提交于 2019-12-17 20:26:38
问题 I'm trying to add logging to methods decorated with an attribute using Spring.Net for AOP . Step 1: Reference 'Spring.Core', 'Spring.Aop', 'Common.Logging' Step 2: Create an advice: using AopAlliance.Intercept; namespace MyApp.Aspects { public class LoggingAdvice : IMethodInterceptor { public object Invoke(IMethodInvocation invocation) { //todo: log started object rval = invocation.Proceed(); return rval; //todo: log finished } } } Step 3: Create an attribute: using System; namespace MyApp

How to end Singleton-object queue if I use Spring AOP cross-cutting concerns + log4net for logging

让人想犯罪 __ 提交于 2019-12-13 16:55:30
问题 I have an application, that use Spring.AOP library to apply proxy-object to log what methods of program do (I use xml-configuration). Before I used log4net to log messages with Spring.AOP(simplified class): public class CommandLoggingAdvice : IMethodInterceptor { // here I get an instance of log4net private ILog _Logger = null; protected ILog Logger { _Logger = LogManager.GetLogger("Logger1"); } public object Invoke(IMethodInvocation invocation) { Logger1.Info("Now we enter to method"); //

How do I override the default isolation level when using the Transaction attribute in Spring.Net

我的未来我决定 提交于 2019-12-13 02:03:06
问题 When using the Transaction() attribute on a method the default isolation level is ReadCommitted. What I want to do is set the default isolation level to ReadUncommitted in the Spring.NET config ( so as not to modify all the Transaction attribute definitions that exist currently) How do I do it ? Can it be done with Spring.NET 1.2 ? I've tried to follow the documentation using tx:advice etc to no avail. I've even stepped in to the code of Spring with Reflector but all I seem to understand from

Spring.NET & Constructor Interceptors

两盒软妹~` 提交于 2019-12-12 16:04:20
问题 I'm trying to do some AOP over objects at construction time, and found IConstructorInterceptor, which would be perfect for what I want but it doesn't appear to work (in version 1.2 at least). I've also looked at both the IObjectPostProcessor & the IInstantiationAwareObjectPostProcessor, but I can't find any way to do processing on an object around construction time... The PostProcessPropertyValues method on the IInstantiationAwareObjectPostProcessor is close, but it only passes through setter