Re: Creating a "public only" constructor

Dean Cleaver <[email protected]> Mon, 6 Apr 2009 20:06:51 +1200
Newsgroups gmane.comp.windows.devel.dotnet.advanced
Message-ID <8E588B65FD82DF448592A3219102C395035CD2EE70@SXSLAKL001.xceptionsoftware.com>
Frans,

If it were a new design yes - but it's not. The code generation has allowed for this separate server capability, but I fear it cannot be utilised fully because the code was historically never designed to work with it, and without hundreds of hours of trawling through the current codebase it can't be successfully changed to a class factory type scenario.

Dino

-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:[email protected]] On Behalf Of Frans Bouma
Sent: Monday, 06 April 2009 19:57
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] Creating a "public only" constructor

Dean,

I have the feeling the concern whether OTHER objects are created on the same
server is not the concern of the class you want to instantiate but the
concern of a repository or other object. I know you're facing a large pile
of code, but you have to make a change somewhere anyway. I'd factor out this
concern from this class and create factories to produce the proper instances
on the right server/service.

	FB

> Hmm - yeah. Not a bad idea... but would mean that only the Business
Services
> layer would ever compile in that release, and everything else would fail.
> 
> -----Original Message-----
> From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> [email protected]] On Behalf Of Dave Jones
> Sent: Monday, 06 April 2009 19:31
> To: [email protected]
> Subject: Re: [ADVANCED-DOTNET] Creating a "public only" constructor
> 
> Wrap the constructor in a #if release?   Then it won't be available in
> debug?
> 
> Dave
> 
> 
> 
> 
> -----Original Message-----
> From:         Dean Cleaver <[email protected]>
> 
> Date:         Mon, 6 Apr 2009 16:02:43
> To: <[email protected]>
> Subject: Re: [ADVANCED-DOTNET] Creating a "public only" constructor
> 
> 
> The second constructor allows you to create a business services object on
a
> different connection to the default - so I can specifically create
business
> services objects connected to 2 different servers from within the same
> application. I then want to ensure that if I create an Invoice object on a
> given server, than any InvoiceItems it creates are on the same server,
which
> would be done by using the second constructor. If a developer accidentally
> uses the default constructor, it could make a mess of the system.
> 
> -----Original Message-----
> From: Discussion of advanced .NET topics. [mailto:ADVANCED-
> [email protected]] On Behalf Of Shawn Wildermuth
> Sent: Monday, 06 April 2009 15:55
> To: [email protected]
> Subject: Re: [ADVANCED-DOTNET] Creating a "public only" constructor
> 
> I don't think you can.  Can you explain why you want to protect it from
> internal classes?
> 
> Thanks,
> 
> Shawn Wildermuth
> http://wildermuth.com
> https://agilitrain.com
> Microsoft MVP (C#), MCSD.NET, Author and Speaker
> 
> The Silverlight Tour is coming to a city near you!
> 
> 
> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[email protected]] On Behalf Of Dean Cleaver
> Sent: Sunday, April 05, 2009 11:42 PM
> To: [email protected]
> Subject: [ADVANCED-DOTNET] Creating a "public only" constructor
> 
> Hey, anyone know if you can do this with attributes or something? I want
to
> have 2 public constructors:
> 
> public ClassName()
> {
> }
> 
> public ClassName(some param)
> {
> }
> 
> I want both publically accessible, but I want the default one
*inaccessible*
> internally. Can that be done?
> 
> Dino
> 
> ===================================
> View archives and manage your subscription(s) at
> http://peach.ease.lsoft.com/archives
> 
> ===================================
> View archives and manage your subscription(s) at
> http://peach.ease.lsoft.com/archives
> 
> ===================================
> View archives and manage your subscription(s) at
> http://peach.ease.lsoft.com/archives
> 
> ===================================
> View archives and manage your subscription(s) at
> http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives