Re: [ADVANCED-DOTNET] PluginManager - Using Loaded Types (Take 2)

2007-10-17 Thread Peter Ritchie
As soon as you reference a type from an assembly you'll load that assembly into the main AppDomain and it will be unloadable and in-use (i.e. not updatable). So, you must always reference it indirectly. This is usually done with an interface defined in a third assembly. The types in your plugin

Re: [ADVANCED-DOTNET] Singleton and Database Connection challange

2007-10-17 Thread Mark Brackett
I'm not sure what benefit grading the code offers, unless you have a rule that no code below C (or B or A, etc.) makes it into production. A simple pass/fail scale is good enough for me (along with requisite advice on getting from fail to pass, of course). In this case, though, it's not that the

Re: [ADVANCED-DOTNET] Singleton and Database Connection challange

2007-10-17 Thread Shane Courtrille
Agreed. Code reviews without any feedback as to the specific problems is definitely no where near optimal. Code reviews should be a learning experience Shane On 10/17/07, Sébastien Lorion <[EMAIL PROTECTED]> wrote: > > Patterns are just that, patterns. They may (or may not) be the building > bl

Re: [ADVANCED-DOTNET] Singleton and Database Connection challange

2007-10-17 Thread Sébastien Lorion
Patterns are just that, patterns. They may (or may not) be the building blocks of a solution. You don't try to make your solution fit a pattern, you design your solution and then see if some patterns could further make it more modular, robust, performant, etc. Leave Java world with so much classes

Re: [ADVANCED-DOTNET] Singleton and Database Connection challange

2007-10-17 Thread Ryan Heath
> Regarding ASP.NET, I'm of the school of thought that database > connections be created at function level; as in, created and destroyed > many many times (if necessary) throughout the page life-cycle. > We do keep the connection "alive" during the page request. We were seeing too many calls to th

Re: [ADVANCED-DOTNET] Singleton and Database Connection challange

2007-10-17 Thread Ryan Heath
> I personally think that grading the code as A or D is not a good idea. We are > not > evaluating a person / dev but the code. Huh, but the *code* is evaluated, not the person who wrote it... // Ryan === This list is hosted by DevelopMentor® http://www.develop.

Re: [ADVANCED-DOTNET] PluginManager - Using Loaded Types (Take 2)

2007-10-17 Thread Graeme Taylor
Thanks for the reply... The plot thickens a bit now! I can now create a proxy where I can access the implementations of the methods - all good so far. Following a bit of further investigation, the problem I described in original post occurs if triggered by a remote message call. Example - plugi

Re: [ADVANCED-DOTNET] PluginManager - Using Loaded Types (Take 2)

2007-10-17 Thread Ryan Heath
What type is PluginManager.CreateInstance returning? Its seems that the returned proxy should be unwrapped, that is, call either PluginManager.CreateInstanceAndUnwrap (if exists) or cast the return object to an ObjectHandle and Unwrap it from there. proxyObj = PluginManager.CreateInstance(...) re

Re: [ADVANCED-DOTNET] Singleton and Database Connection challange

2007-10-17 Thread Abhijit Gadkari
Thanks for this excellent responses. I agree with Ben that code consistency is important and I am trying to enforce it in my team. Well, the reason I posted this code is to see the dev reaction on this topic. Pattern beginners think that pattern is the panacea to all oops problems. This singleton c

[ADVANCED-DOTNET] PluginManager - Using Loaded Types (Take 2)

2007-10-17 Thread Graeme Taylor
Apologies: Accidentally hit the tab key while typing causing a premature post! Please ignore any previous post by me today! Hi All, I've created a PluginManager assembly, using the one in 'The CodeProject' as a base. My understanding of the plugin manager is that it dynamically picks up types i

[ADVANCED-DOTNET] PluginManager - Using Loaded Types

2007-10-17 Thread Graeme Taylor
Hi All, I've created a PluginManager assembly, using the one in 'The CodeProject' as a base. My understanding of the plugin manager is that it dynamically picks up types in an assembly (by watching the plugin directory) and then makes the type available within the main AppDomain. How it achieves

Re: [ADVANCED-DOTNET] Singleton and Database Connection challange

2007-10-17 Thread Baris Acar
why not use Enterprise Data Application Block? On 10/17/07, Ben Joyce <[EMAIL PROTECTED]> wrote: > Many thanks for the clarification, gentelmen. > > On 10/17/07, Richard Blewett <[EMAIL PROTECTED]> wrote: > > Dispose also returns the connection to the connection pool > > > > Regards > > > > Richar

Re: [ADVANCED-DOTNET] Singleton implementation of database connection in ASP.NET application

2007-10-17 Thread Ben Joyce
With regards to #4, the example given showed both braced-IFs and non-braced-IFs so I would recommend consistency over any personal preference on coding style. *ahem* :) Ben On 10/17/07, Mark Brackett <[EMAIL PROTECTED]> wrote: > Assuming you actually *want* a singleton (see the numerous other re

Re: [ADVANCED-DOTNET] Singleton implementation of database connection in ASP.NET application

2007-10-17 Thread Mark Brackett
Assuming you actually *want* a singleton (see the numerous other replies for the reasons that may not be the case), I still see a couple of issues with your implementation. 1. The null check in GetDbConnection is worthless. If _d is null, then you failed to initialize it. If you failed to initiali

Re: [ADVANCED-DOTNET] Singleton and Database Connection challange

2007-10-17 Thread Ben Joyce
Many thanks for the clarification, gentelmen. On 10/17/07, Richard Blewett <[EMAIL PROTECTED]> wrote: > Dispose also returns the connection to the connection pool > > Regards > > Richard Blewett - DevelopMentor > > > -Original Message- > > From: Discussion of advanced .NET topics. [mailto: