http://stackoverflow.com/questions/784253/castle-windsor-passing-constructor-parameters

---
Patrick Steele
http://weblogs.asp.net/psteele



On Mon, Apr 12, 2010 at 12:02 PM, Juanjo <[email protected]> wrote:
> Hi guys,
>
> I've been looking for this problem and I haven't found a solution. I'd
> like you help me with this issue.
>
> My problem is:
>
> I have two classes
>
> --
> public class AccessConnectionString : IConnectionString
>    {
>        string provider;
>        string db;
>        string user;
>        string password;
>
>        public AccessConnectionString(string db, string user, string
> password)
>        {
>            this.provider = "Microsoft.Jet.OLEDB.4.0";
>            this.db = db;
>            this.user = user;
>            this.password = password;
>        }
>
>        public string getConnectionString()
>        {
>            string connectionString = "Provider=" + provider + ";Data
> Source=" + db +
>                ";User Id=" + user + ";Password=" + password + ";";
>
>            return connectionString;
>        }
>    }
>
> --
>
> public class AccessOleDbSessionProvider<T> : ISessionProvider<T> where
> T : new()
>    {
>        private IConnectionString connectionString;
>
>        public AccessOleDbSessionProvider(IConnectionString
> connectionString) {
>            this.connectionString = connectionString;
>        }
>
>        public T getSesion() {
>            ... connectionString.getConnectionString();
>
>        }
>
>    }
> --
>
> When I resolve an "AccessOleDbSessionProvider" object I'd like to set
> the "AccessConnectionString" constructor params. These are obtain at
> runtime from a form.
>
> Can I do this? How? Else, what's the best solution?

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to