Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

Question regarding implentation of factory pattern with internal objects

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carlo Razzeto - 01 Mar 2006 20:56 GMT
I have a question regarding the implementation of a factory design pattern
and objects which are declared at internal scope. Here is my situation:

Currently I'm working on an order processing library which will power a
webservice. I do not want any programmer outside of my libary to be able to
inheret from or even see the objects responcible for processing the order
entry XML, instead I have provided a public sealed class library which
exposes a method which accepts order entry XML. What this method needs to
do, is find the most appropriate order processing class, instantiate it and
pass the order entry data to it. However, because all these classes are
internal, with internal constructors, Activator.CreateInstance() will not be
able to create the objects. So I was wondering if anyone out there had more
advanced knowledge of Reflection than I, and might be able to point me in
the right direction with handling this type of situation.

I'm also running up against a wall with this issue in a database abtraction
library I wrote which publicly exposes the specific database objects,
(should) have internal constructors so end programmers must use the provided
factory method to establish a database connection.

Carlo Razzeto
Carlo Razzeto - 01 Mar 2006 21:39 GMT
Update,
As far as my first situation, I was able to get around the problem by
keeping the class internal, but the constructor public. I really see this as
being a bit of a hack solution, but it's about the best I got right now
because I can't create these objects based on a switch statement, the
possiblity that we will be adding new objects often enough to make this
impractical is too great. I guess the DB libary I could use a switch
statment as that should be fairly constant, but it'd still be nice to have a
more automated solution.

>I have a question regarding the implementation of a factory design pattern
>and objects which are declared at internal scope. Here is my situation:
[quoted text clipped - 18 lines]
>
> Carlo Razzeto

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.