Search Results

Search found 1431 results on 58 pages for 'richard castle'.

Page 1/58 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Good book on Castle Project?

    - by David
    Does anyone know of a good book on the Castle Project? I'm interested in learning more about any of the Castle projects (ActiveRecord, MonoRail, Windsor, anything!) and searches for Castle on Amazon are a little frustrating with the need to weed out all the fiction and nonsense.

    Read the article

  • Castle MonoRail ARDataBind trying to bind to non-existent row

    - by dave thieben
    I have a shopping cart application running on MonoRail and using Castle ActiveRecord/NHibernate, and there is a ShoppingCart table and a ShoppingCartItems table, which are mapped to entities. Here's the scenario: a user adds things to the shopping cart, say 5 items, and goes to view the cart. The cart shows all 5 items. the user duplicates the tab/window and gets another tab of the same cart (call it tab B). the user removes an item from the cart, so now there are 4 items in tab B, but in the original tab A, there are still 5 items. the user goes back to tab A, and updates something in the cart and clicks the "update" button which submits the changes. my MonoRail action tries to do an ARDataBind on ShoppingCartItems using the data from the view, which includes all 5 items. when it gets to the item that the user deleted from tab B, it throws a "No row with the given identifier exists" for that item. I can't figure out if there is a way to have it not bind that row, return null, return new instance, etc.? there is an AutoLoadBehavior parameter on the ARDataBind attribute, but that appears to only affect loading of child entities, and not the root entity. regardless of which option I choose, I get the exception before control even enters the action method (except AutoLoadBehavior.Never, but that doesn't really help me). instead, I have code that calls Request.ObtainParamsNode() to pull the form nodes and parse them manually into objects, and ignores the ones that no longer exist. is there a better way? thanks.

    Read the article

  • Problem with initializing a type with WinsdorContainer

    - by the_drow
    public ApplicationView(string[] args) { InitializeComponent(); string configFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config"); FileInfo configFileInfo = new FileInfo(configFilePath); XmlConfigurator.ConfigureAndWatch(configFileInfo); IConfigurationSource configSource = ConfigurationManager.GetSection("ActiveRecord") as IConfigurationSource; Assembly assembly = Assembly.Load("Danel.Nursing.Model"); ActiveRecordStarter.Initialize(assembly, configSource); WindsorContainer windsorContainer = ApplicationUtils.GetWindsorContainer(); windsorContainer.Kernel.AddComponentInstance<ApplicationView>(this); windsorContainer.Kernel.AddComponent(typeof(ApplicationController).Name, typeof(ApplicationController)); controller = windsorContainer.Resolve<ApplicationController>(); // exception is thrown here OnApplicationLoad(args); } The stack trace is this: Castle.MicroKernel.ComponentActivator.ComponentActivatorException was unhandled Message="ComponentActivator: could not instantiate Danel.Nursing.Scheduling.Actions.DataServices.NurseAbsenceDataService" Source="Castle.MicroKernel" StackTrace: at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, Object[] arguments, Type[] signature) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveServiceDependency(CreationContext context, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver parentResolver, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context, Type[]& signature) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveServiceDependency(CreationContext context, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver parentResolver, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context, Type[]& signature) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.ResolveServiceDependency(CreationContext context, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.Resolvers.DefaultDependencyResolver.Resolve(CreationContext context, ISubDependencyResolver parentResolver, ComponentModel model, DependencyModel dependency) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateConstructorArguments(ConstructorCandidate constructor, CreationContext context, Type[]& signature) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service) at Castle.MicroKernel.DefaultKernel.get_Item(Type service) at Castle.Windsor.WindsorContainer.Resolve(Type service) at Castle.Windsor.WindsorContainer.ResolveT at Danel.Nursing.Scheduling.ApplicationView..ctor(String[] args) in E:\Agile\Scheduling\Danel.Nursing.Scheduling\ApplicationView.cs:line 65 at Danel.Nursing.Scheduling.Program.Main(String[] args) in E:\Agile\Scheduling\Danel.Nursing.Scheduling\Program.cs:line 24 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.ArgumentNullException Message="Value cannot be null.\r\nParameter name: types" Source="mscorlib" ParamName="types" StackTrace: at System.Type.GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, Type[] signature) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, Object[] arguments, Type[] signature) InnerException: It actually says that the type that I'm trying to initialize does not exist, I think. This is the concreate type that it complains about: namespace Danel.Nursing.Scheduling.Actions.DataServices { using System; using Helpers; using Rhino.Commons; using Danel.Nursing.Model; using NHibernate.Expressions; using System.Collections.Generic; using DateUtil = Danel.Nursing.Scheduling.Actions.Helpers.DateUtil; using Danel.Nursing.Scheduling.Actions.DataServices.Interfaces; public class NurseAbsenceDataService : AbstractDataService<NurseAbsence>, INurseAbsenceDataService { NurseAbsenceDataService(IRepository<NurseAbsence> repository) : base(repository) { } //... } } The AbstractDataService only holds the IRepository for now. Anyone got an idea why the exception is thrown?

    Read the article

  • Castle Windsor Project Includes in Config

    - by Michael Edwards
    I want the properties section of the Castle config to be included from another file. I.e: <castle> <include uri="file://properties.config" /> </castle> The properties.config would then look like: <properties> <smtp>10.10.10.10</smtp> <username>john</username> </properties> I can get the include to work for components but not for properties. If I try to do this with properties I get an exception thrown. Is this a limitation of Castle?

    Read the article

  • Where is Castle's AbstractFacility class?

    - by ripper234
    I am trying to compile Castle.Facilities.ActiveRecordIntegration with the trunk version of Castle.Core. ARIntegration uses 'AbstractFacility', which sits in the Castle.MicroKernel DLL. The DLL is now nowhere to be found. Where is ARIntegration/MicroKernel? How do I proceed?

    Read the article

  • How to get reference to SqlConnection (or Connection string) in Castle ActiveRecord?

    - by VoimiX
    how can I get reference to current SqlConnection or Sqlconnection in config? I found http://svn.castleproject.org:8080/svn/castle/trunk/ActiveRecord/Castle.ActiveRecord.Tests/DifferentDatabaseScopeTestCase.cs and code private string GetSqlConnection() { IConfigurationSource config = GetConfigSource(); IConfiguration db2 = config.GetConfiguration(typeof(ActiveRecordBase)); string conn = string.Empty; foreach (IConfiguration child in db2.Children) { if (child.Name == "connection.connection_string") { conn = child.Value; } } return conn; } But I cant understand where I can find "GetConfigSource" implementation? Is this standart Castle helper function or not? I use these namespaces using Castle.ActiveRecord; using NHibernate.Criterion; using NHibernate; using Castle.Core.Configuration; using Castle.ActiveRecord.Framework;

    Read the article

  • Access custom attribute on method from Castle Windsor interceptor

    - by RobW
    I am trying to access a custom attribute applied to a method within a castle interceptor, e.g.: [MyCustomAttribute(SomeParam = "attributeValue")] public virtual MyEntity Entity { get; set; } using the following code: internal class MyInterceptor : IInterceptor { public void Intercept(IInvocation invocation) { if (invocation.Method.GetCustomAttributes(typeof(MyCustomAttribute), true) != null) { //Do something } } } The interceptor is firing OK when the method is called but this code does not return the custom attribute. How can I achieve this?

    Read the article

  • FluentNHibernate 1.1 / Castle 1.1 dependency

    - by Innogetics
    I would like to upgrade my FluentNHibernate to version 1.1, but I found out it uses Castle.Core 1.1. I use Castle.Windsor 1.2 in my app which works with Castle.Core 1.2. I now need to find a version of Castle.Windsor that uses this earlier version of Castle.Core, but I can't find it anywhere. What do you recommend I should do? Wait for a version of FluentNHibernate that uses the latest Castle.Core? OR build FluentNHibernate 1.1 from source using the latest Castle.Core? OR downgrade my Castle.Windsor version?

    Read the article

  • castle IOC - resolving circular references

    - by Frederik
    Hi quick question for my MVP implementation: currently I have the code below, in which both the presenter and view are resolved via the container. Then the presenter calls View.Init to pass himself to the view. I was wondering however if there is a way to let the container fix my circular reference (view - presenter, presenter - view). class Presenter : IPresenter { private View _view; public Presenter(IView view, ...){ _view = view; _view.Init(this) } } class View : IView { private IPresenter _presenter; public void Init(IPresenter presenter){ _presenter = presenter; } } Kind regards Frederik

    Read the article

  • Castle ActiveRecord "Could not compile the mapping document: (string)"

    - by Nick
    Hi I am having getting an exception when trying to initialize ActiveRecord and I cannot figure out what I am missing. I am trying to convince the company I work for to use Castle ActiveRecord and it won't look good if I can't demonstrate how it works. I have work on projects before with Castle ActiveRecord and I had never experience this problem before. Thanks for your help The exception that I get is Stack Trace: at Castle.ActiveRecord.ActiveRecordStarter.AddXmlString(Configuration config, String xml, ActiveRecordModel model) at Castle.ActiveRecord.ActiveRecordStarter.AddXmlToNHibernateCfg(ISessionFactoryHolder holder, ActiveRecordModelCollection models) at Castle.ActiveRecord.ActiveRecordStarter.RegisterTypes(ISessionFactoryHolder holder, IConfigurationSource source, IEnumerable`1 types, Boolean ignoreProblematicTypes) at Castle.ActiveRecord.ActiveRecordStarter.Initialize(IConfigurationSource source, Type[] types) at ConsoleApplication1.Program.Main(String[] args) in C:\Projects\CastleDemo\ConsoleApplication1\Program.cs:line 20 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() Inner Exception: {"Could not compile the mapping document: (string)"} Below is my configuration file: <add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" /> <add key="dialect" value="NHibernate.Dialect.MsSql2000Dialect" /> <add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /> <add key="connection.connection_string" value="Data Source=SPIROS\SQLX;Initial Catalog=CastleDemo;Integrated Security=SSPI" /> <add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" /> and this is the main method that runs the initialization: static void Main(string[] args) { //Configure ActiveRecord source XmlConfigurationSource source = new XmlConfigurationSource("../../config.xml"); // //Initialazi ActiveRecord ActiveRecordStarter.Initialize( source, typeof(Product)); // //Create Schema ActiveRecordStarter.CreateSchema(); // }

    Read the article

  • Castle Windsor and its own configuration file

    - by Coppermill
    I am using Castle Windsor for IoC, and have the configuration held in the web.config/app.config, using the following factory: public static TYPE Factory(string component) { var windsorContainer = new WindsorContainer(new XmlInterpreter()); var service = windsorContainer.Resolve<TYPE>(component); if (service == null) throw new ArgumentNullException(string.Format("Unable to find container {0}", component)); return service; } and my web.config looking like this: <configuration> <configSections> <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/> </configSections> <castle> <components> <component id="Data" service="Data.IData, Data" type="Data.DataService, Data"/> </components> </castle> <appSettings>....... Which works fine, but I'd like to place the configuration for Castle Windsor in a file called castle.config. How do I do this?

    Read the article

  • Problems with Castle DynamicProxy2 on .Net 3.5 SP1 on Win2003 Server

    - by Andrea Balducci
    I've an mvc + nh asp.net application. On my dev machine (win 7 Ent) all works fine, if deployed on a Win 2k3 (tried 2 different vm and one phisical machine) I got the following error.. anyone can help? Cannot explain this issue (tried the same build, so i think it'a machine configuration issue).. Derived method 'set_ID' in type 'CustomerProxy75950979a2a048e889584c21696f7f1b' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' cannot reduce access [TypeLoadException: Derived method 'set_ID' in type 'CustomerProxy75950979a2a048e889584c21696f7f1b' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' cannot reduce access.] System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32 handle, Module module) +0 System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() +915 System.Reflection.Emit.TypeBuilder.CreateType() +108 Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType() +48 Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type[] interfaces, ProxyGenerationOptions options) +3821 Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options) +84 Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, Object[] constructorArguments, IInterceptor[] interceptors) +92 Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, IInterceptor[] interceptors) +21 NHibernate.ByteCode.Castle.ProxyFactory.GetProxy(Object id, ISessionImplementor session) +283

    Read the article

  • Using Fluent NHibernate with Castle Windsor and the NHibernate Facility

    - by Andrew
    Ive managed to get Fluent NHibernate 1.1 playing nicely with Castle Windsor 2.1. This involved me recompiling NHibernate.ByteCode.Castle.dll and it all works fine. Ive managed to do the same thing this time with Castle Windsor 2.5, havent tried it yet but its not complaining which is good enough for me at the moment. However Im also using the Castle NHibernate Facility and that is another story. The version of the NHibernate Facility that is compatible with Castle 2.5 requires a much later version of NHibernate. Is there an easy way to get the NHibernate Facility to work with NHibernate 2.1 and Castle Core 2.5?

    Read the article

  • Can Castle.Windsor do automatic resolution of concrete types

    - by Anthony
    We are evaluating IoC containers for C# projects, and both Unity and Castle.Windsor are standing out. One thing that I like about Unity (NInject and StructureMap also do this) is that types where it is obvious how to construct them do not have to be registered with the IoC Container. Is there way to do this in Castle.Windsor? Am I being fair to Castle.Windsor to say that it does not do this? Is there a design reason to deliberately not do this, or is it an oversight, or just not seen as important or useful? I am aware of container.Register(AllTypes... in Windsor but that's not quite the same thing. It's not entirely automatic, and it's very broad. To illustrate the point, here are two NUnit tests doing the same thing via Unity and Castle.Windsor. The Castle.Windsor one fails. : namespace SimpleIocDemo { using NUnit.Framework; using Castle.Windsor; using Microsoft.Practices.Unity; public interface ISomeService { string DoSomething(); } public class ServiceImplementation : ISomeService { public string DoSomething() { return "Hello"; } } public class RootObject { public ISomeService SomeService { get; private set; } public RootObject(ISomeService service) { SomeService = service; } } [TestFixture] public class IocTests { [Test] public void UnityResolveTest() { UnityContainer container = new UnityContainer(); container.RegisterType<ISomeService, ServiceImplementation>(); // Root object needs no registration in Unity RootObject rootObject = container.Resolve<RootObject>(); Assert.AreEqual("Hello", rootObject.SomeService.DoSomething()); } [Test] public void WindsorResolveTest() { WindsorContainer container = new WindsorContainer(); container.AddComponent<ISomeService, ServiceImplementation>(); // fails with exception "Castle.MicroKernel.ComponentNotFoundException: // No component for supporting the service SimpleIocDemo.RootObject was found" // I could add // container.AddComponent<RootObject>(); // but that approach does not scale RootObject rootObject = container.Resolve<RootObject>(); Assert.AreEqual("Hello", rootObject.SomeService.DoSomething()); } } }

    Read the article

  • ASP.NET MVC Using Castle Windsor IoC

    - by Mad Halfling
    I have an app, modelled on the one from Apress Pro ASP.NET MVC that uses castle windsor's IoC to instantiate the controllers with their respective repositories, and this is working fine e.g. public class ItemController : Controller { private IItemsRepository itemsRepository; public ItemController(IItemsRepository windsorItemsRepository) { this.itemsRepository = windsorItemsRepository; } with using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Castle.Windsor; using Castle.Windsor.Configuration.Interpreters; using Castle.Core.Resource; using System.Reflection; using Castle.Core; namespace WebUI { public class WindsorControllerFactory : DefaultControllerFactory { WindsorContainer container; // The constructor: // 1. Sets up a new IoC container // 2. Registers all components specified in web.config // 3. Registers all controller types as components public WindsorControllerFactory() { // Instantiate a container, taking configuration from web.config container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle"))); // Also register all the controller types as transient var controllerTypes = from t in Assembly.GetExecutingAssembly().GetTypes() where typeof(IController).IsAssignableFrom(t) select t; foreach (Type t in controllerTypes) container.AddComponentWithLifestyle(t.FullName, t, LifestyleType.Transient); } // Constructs the controller instance needed to service each request protected override IController GetControllerInstance(Type controllerType) { return (IController)container.Resolve(controllerType); } } } controlling the controller creation. I sometimes need to create other repository instances within controllers, to pick up data from other places, can I do this using the CW IoC, if so then how? I have been playing around with the creation of new controller classes, as they should auto-register with my existing code (if I can get this working, I can register them properly later) but when I try to instantiate them there is an obvious objection as I can't supply a repos class for the constructor (I was pretty sure that was the wrong way to go about it anyway). Any help (especially examples) would be much appreciated. Cheers MH

    Read the article

  • Failed Castle ActiveRecord TransactionScope causes future queries to be invalid

    - by mbp
    I am trying to solve an issue when using a Castle ActiveRecord TransactionScope which is rolled back. After the rollback, I am unable to query the Dog table. The "Dog.FindFirst()" line fails with "Could not perform SlicedFindAll for Dog", because it cannot insert dogMissingName. using (new SessionScope()) { try { var trans = new TransactionScope(TransactionMode.New, OnDispose.Commit); try { var dog = new Dog { Name = "Snowy" }; dog.Save(); var dogMissingName = new Dog(); dogMissingName.Save(); } catch (Exception) { trans.VoteRollBack(); throw; } finally { trans.Dispose(); } } catch (Exception ex) { var randomDog = Dog.FindFirst() Console.WriteLine("Random dog : " + randomDog.Name); } } Stacktrace is as follows: Castle.ActiveRecord.Framework.ActiveRecordException: Could not perform SlicedFindAll for Dog ---> NHibernate.Exceptions.GenericADOException: could not insert: [Mvno.Dal.Dog#219e86fa-1081-490a-92d1-9d480171fcfd][SQL: INSERT INTO Dog (Name, Id) VALUES (?, ?)] ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'Name', table 'Dog'; column does not allow nulls. INSERT fails. The statement has been terminated. ved System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) ved System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) ved System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) ved System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) ved System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) ved System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) ved System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) ved System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) ved System.Data.SqlClient.SqlCommand.ExecuteNonQuery() ved NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd) ved NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation) ved NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session) --- End of inner exception stack trace --- ved NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session) ved NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session) ved NHibernate.Action.EntityInsertAction.Execute() ved NHibernate.Engine.ActionQueue.Execute(IExecutable executable) ved NHibernate.Engine.ActionQueue.ExecuteActions(IList list) ved NHibernate.Engine.ActionQueue.ExecuteActions() ved NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session) ved NHibernate.Event.Default.DefaultAutoFlushEventListener.OnAutoFlush(AutoFlushEvent event) ved NHibernate.Impl.SessionImpl.AutoFlushIfRequired(ISet`1 querySpaces) ved NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) ved NHibernate.Impl.CriteriaImpl.List(IList results) ved NHibernate.Impl.CriteriaImpl.List() ved Castle.ActiveRecord.ActiveRecordBase.SlicedFindAll(Type targetType, Int32 firstResult, Int32 maxResults, Order[] orders, ICriterion[] criteria) --- End of inner exception stack trace --- ved Castle.ActiveRecord.ActiveRecordBase.SlicedFindAll(Type targetType, Int32 firstResult, Int32 maxResults, Order[] orders, ICriterion[] criteria) ved Castle.ActiveRecord.ActiveRecordBase.FindFirst(Type targetType, Order[] orders, ICriterion[] criteria) ved Castle.ActiveRecord.ActiveRecordBase.FindFirst(Type targetType, ICriterion[] criteria) ved Castle.ActiveRecord.ActiveRecordBase`1.FindFirst(ICriterion[] criteria)

    Read the article

  • Castle Windsor using wrong component to satisfy a dependency

    - by Neil Barnwell
    I have the following component mapping in Windsor xml: <component id="dataSession.DbConnection" service="System.Data.IDbConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" lifestyle="custom" customLifestyleType="MyCompany.Castle.PerOperationLifestyle.PerOperationLifestyleManager, MyCompany.Castle"> <parameters> <connectionString>server=(local);database=MyCompany;trusted_connection=true;application name=OperationScopeTest;</connectionString> </parameters> </component> <component id="dataSession.DataContext" service="System.Data.Linq.DataContext, System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" type="MyCompany.BusinessLogic.MyCompanyDataContext, MyCompany.BusinessLogic" lifestyle="custom" customLifestyleType="MyCompany.Castle.PerOperationLifestyle.PerOperationLifestyleManager, MyCompany.Castle"> <parameters> <connection>${dataSession.DbConnection}</connection> </parameters> </component> However, when I ask the container for a DataContext, it actually uses the constructor requiring a connection string, despite the ${dataSession.DbConnection} being an IDbConnection. Why is this, and how to I make Windsor use the correct constructor?

    Read the article

  • Castle Windsor upgrade causes TypeLoadException for generic types

    - by Neil Barnwell
    I have the following mapping in my Castle Windsor xml file which has worked okay (unchanged) for some time: <component id="defaultBasicRepository" service="MyApp.Models.Repositories.IBasicRepository`1, MyApp.Models" type="MyApp.Models.Repositories.Linq.BasicRepository`1, MyApp.Models" lifestyle="perWebRequest"/> I got this from the Windsor documentation at http://www.castleproject.org/container/documentation/v1rc3/usersguide/genericssupport.html. Since I upgraded Windsor, I now get the following exception at runtime: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.TypeLoadException: GenericArguments[0], 'T', on 'MyApp.Models.Repositories.Linq.BasicRepository`1[TEntity]' violates the constraint of type parameter 'TEntity'. Source Error: Line 44: public static void ConfigureIoC() Line 45: { Line 46: var windsor = new WindsorContainer("Windsor.xml"); Line 47: Line 48: ServiceLocator.SetLocatorProvider(() = new WindsorServiceLocator(windsor)); I'm using ASP.NET MVC 1.0, Visual Studio 2008 and Castle Windsor as downloaded from http://sourceforge.net/projects/castleproject/files/InversionOfControl/2.1/Castle-Windsor-2.1.1.zip/download Can anyone shed any light on this? I'm sure the upgrade of Castle Windsor is what caused it - it's been working well for ages.

    Read the article

  • castle PerRequestLifestyle not recognize

    - by Herman
    Hi all, New to Castle/Windsor, please bear with me. I am currently using the framework System.Web.Mvc.Extensibility and in its start up code, it registered HttpContextBase like the following: container.Register(Component.For<HttpContextBase>().LifeStyle.Transient.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current))); What I wanted to do is to change the behavior and change the lifestyle of httpContextBase to be PerWebRequest. so I have change the code to the following: container.Register(Component.For<HttpContextBase>().LifeStyle.PerWebRequest.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current))); However, when I do this, I got the following error: System.Configuration.ConfigurationErrorsException: Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule Add '<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.MicroKernel" />' to the <httpModules> section on your web.config which I did under <system.web> and <system.webServer>, however, I am still getting the same error. Any hints? Thanks in advance.

    Read the article

  • Castle Windsor, Fluent Nhibernate, and Automapping Isession closed problem

    - by SImon
    I'm new to the whole castle Windsor, Nhibernate, Fluent and Automapping stack so excuse my ignorance here. I didn't want to post another question on this as it seems there are already a huge number of questions that try to get a solution the Windsor nhib Isession management problem, but none of them have solved my problem so far. I am still getting a ISession is closed exception when I'm trying to call to the Db from my Repositories,Here is my container setup code. container.AddFacility<FactorySupportFacility>() .Register( Component.For<ISessionFactory>() .LifeStyle.Singleton .UsingFactoryMethod(() => Fluently.Configure() .Database( MsSqlConfiguration.MsSql2005. ConnectionString( c => c.Database("DbSchema").Server("Server").Username("UserName").Password("password"))) .Mappings ( m => m.AutoMappings.Add ( AutoMap.AssemblyOf<Message>(cfg) .Override<Client>(map => { map.HasManyToMany(x => x.SICCodes).Table("SICRefDataToClient"); }) .IgnoreBase<BaseEntity>() .Conventions.Add(DefaultCascade.SaveUpdate()) .Conventions.Add(new StringColumnLengthConvention(),new EnumConvention()) .Conventions.Add(new EnumConvention()) .Conventions.Add(DefaultLazy.Never()) ) ) .ExposeConfiguration(ConfigureValidator) .ExposeConfiguration(BuildDatabase) .BuildSessionFactory() as SessionFactoryImpl), Component.For<ISession>().LifeStyle.PerWebRequest.UsingFactoryMethod(kernel => kernel.Resolve<ISessionFactory>().OpenSession() )); In my repositories i inject private readonly ISession session; and use it as followes public User GetUser(int id) { User u; u = session.Get<User>(id); if (u != null && u.Id > 0) { NHibernateUtil.Initialize(u.UserDocuments); } return u; in my web.config inside <httpModules>. i have also added this line <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor"/> I'm i still missing part of the puzzle here, i can't believe that this is such a complex thing to configure for a basic need of any web application development with nHibernate and castle Windsor. I have been trying to follow the code here windsor-nhibernate-isession-mvc and i posted my question there as they seemed to have the exact same issue but mine is not resolved.

    Read the article

  • Using Castle Windsor with FluentValidation In MVC

    - by user332022
    I'm working on getting FluentValidation working with Castle Windsor. I already have a wrapper around Castle Windsor. Here is the code for that: public class ResolveType { private static IWindsorContainer _windsorContainer; public static void Initialize( IWindsorContainer windsorContainer ) { _windsorContainer = windsorContainer; } public static T Of() { return _windsorContainer.Resolve(); } } I am trying to build the FluentValidation factory as is explained at http://www.jeremyskinner.co.uk/2010/02/22/using-fluentvalidation-with-an-ioc-container The article uses StructureMap, but I thought I could adapt it to Castle Windsor like this: public class CastleWindsorValidatorFactory : ValidatorFactoryBase { public override IValidator CreateInstance( Type validatorType) { return ResolveType.Of(); } } Notice, I'm just trying to call into my wrapper so that Windsor can resolve the type reference. The problem is that this doesn't compile. I get 'The type or namespace name 'validatorType' could not be found (are you missing a using directive or an assembly reference?)' How can I make this work?

    Read the article

  • castle monorails httpHandlers

    - by bogdanbrudiu
    I have a question and I hope you can help me solve it... I have a castle monorails application. In web.config file in httphandlers I have *.aspx maped to monorails (my hosting does not suport other extensions...) <add verb="*" path="*.aspx" type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory,Castle.MonoRail.Framework"/> The problem is that I have some Webforms pages that I want to work with aspx... So I am adding something like this to the web.config file... <add verb="*" path="connector.aspx*" type="System.Web.UI.PageHandlerFactory"/> <add verb="*" path="ChatPage.aspx*" type="System.Web.UI.PageHandlerFactory"/> <add verb="*" path="Logon.aspx*" type="System.Web.UI.PageHandlerFactory"/> Still it does not work.. What am I doing wrong?

    Read the article

  • Use component id in Castle Windsor generic object configuration

    - by ChoccyButton
    2 questions in one, but very much related. Is it possible with Castle Windsor to resolve a configuration entry such as - Assembly.Namespace.Object1`2[[${ComponentId1}],[${ComponentId2}]], Assembly Where ComponentId1 and ComponentId2 are defined as components. Castle Windsor doesn't seem to be resolving the ComponentId, it is just looking for ComponentId1 in the Castle.Windsor assembly. The second question comes in to play if you can't do the first question. If you have to use a full assembly reference instead of a ComponentId, how can you pass any parameters to the object being created? eg to set ComponentId1.Field1 = "blah", or pass something to the constructor of ComponentId1 Hope that makes sense Update - Following the request for code I've knocked together the following - Objects public class Wrapper<T, T1> where T : ICollector where T1:IProcessor { private T _collector; private T1 _processor; public Wrapper(T collector, T1 processor) { _collector = collector; _processor = processor; } public void GetData() { _collector.CollectData(); _processor.ProcessData(); } } public class Collector1 : ICollector { public void CollectData() { Console.WriteLine("Collecting data from Collector1 ..."); } } public class Processor1 : IProcessor { public void ProcessData() { Console.WriteLine("Processing data from Processor1 ..."); } } repeated so 3 of each type of object in the example Config <components> <component id="Collector1" service="CastleWindsorPlay.ICollector, CastleWindsorPlay" type="CastleWindsorPlay.Collector1, CastleWindsorPlay"/> <component id="Collector2" service="CastleWindsorPlay.ICollector, CastleWindsorPlay" type="CastleWindsorPlay.Collector2, CastleWindsorPlay"/> <component id="Collector3" service="CastleWindsorPlay.ICollector, CastleWindsorPlay" type="CastleWindsorPlay.Collector3, CastleWindsorPlay"/> <component id="Processor1" service="CastleWindsorPlay.IProcessor, CastleWindsorPlay" type="CastleWindsorPlay.Processor1, CastleWindsorPlay"/> <component id="Processor2" service="CastleWindsorPlay.IProcessor, CastleWindsorPlay" type="CastleWindsorPlay.Processor2, CastleWindsorPlay"/> <component id="Processor3" service="CastleWindsorPlay.IProcessor, CastleWindsorPlay" type="CastleWindsorPlay.Processor3, CastleWindsorPlay"/> <component id="Wrapper1" type="CastleWindsorPlay.Wrapper`2[[CastleWindsorPlay.Collector1, CastleWindsorPlay],[CastleWindsorPlay.Processor3, CastleWindsorPlay]], CastleWindsorPlay" /> </components> Instantiation var wrapper = (Wrapper<ICollector, IProcessor>) container.Resolve("Wrapper1"); wrapper.GetData(); This brief example errors with this error message though - Can't create component 'Wrapper1' as it has dependencies to be satisfied. Wrapper1 is waiting for the following dependencies: Services: - CastleWindsorPlay.Collector1 which was not registered. - CastleWindsorPlay.Processor3 which was not registered. The curious part about this is that I can get it to resolve Collector1 and Processor3 individually before the call to the wrapper, but the wrapper still can't see them. This is a basic example, the next thing I'd like to be able to do is when instantiating the Wrapper, set a property on the collector and/or processor. So it could be something like Collector.Id = 10, but set in the config where the wrapper is defined. Setting against the Collector component definition wouldn't work as I'd want to be able to instantiate multiple copies of each Collector, using different Id's Update 2 What I'm actually trying to do is have - <components> <component id="Wrapper1" type="CastleWindsorPlay.Wrapper`2[${Collector1}(id=1)],[${Processor3}]], CastleWindsorPlay" /> <component id="Wrapper2" type="CastleWindsorPlay.Wrapper`2[${Collector1}(id=3)],[${Processor3}]], CastleWindsorPlay" /> </components> Then have another object defined as <component id="Manager" type="CastleWindsorPlay.Manager,CastleWindsorPlay"> <parameters> <wrappers> <array> <item>${Wrapper1}</item> <item>${Wrapper2}</item> </array> </wrappers> </parameters> Then finally in code just be able to call - var manager = (Manager)container.Resolve("Manager"); This should return the manager object, with an array of wrappers populated and the wrappers configured with the correct Collector and Convertor. I know there are errors in the Castle config here, that's why I'm asking the question, I don't know how to set the config up to do what I'm after, or even if it's possible to do it in Castle Windsor

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >