Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Share common code when developing single Control assemblies?

Reply
Thread Tools

Share common code when developing single Control assemblies?

 
 
S.Sigal
Guest
Posts: n/a
 
      08-21-2004
Hello:

Having trouble getting IDE to play nice/accept when designing Controls that need
helper classes...

I would like to compile controls as separate controls -- yet share some common
'helper' functions.

How can I set up -- or get the equivalent workability of --

CustomWebControl1\CustomWebControl1.sln
CustomWebControl2\CustomWebControl2.sln
CustomWebControl3\CustomWebControl3.sln
CustomCode\SharedCode.sln

I tried this approach, with SharedCode being a Project Dependancy for each of
the other three, and while that works in RunTime -- that fails in DesignTime
IDE. (It appears that when I add the Controls to the ToolBox the IDE copies the
dlls pointed to -- but not any dependancies (!!!) -- to another directory before
using it... In other words fails because it only has half of what it needs).

I understand that I could give SharedCode.dll a strong name and put it in the
GACL -- and that might be possible on my computer -- but be impossible to do
with site where I am hosted.(no access to GACL).


Right now, I am cut/copying the helper functions in between assemblies... which
is leading to it being hard to track down/correct bugs globally... And on top of
that -- the helper functions are not small so massive code bloat.

Anyone have an idea on how to make working on controls, without cut/pasting code
all over the place?

Thank you so much!
Sky

PS:
(sorry for repost -- but help is urgently required...
Orig post at: microsoft.public.dotnet.framework.aspnet.webcontro ls)




 
Reply With Quote
 
 
 
 
S.Sigal
Guest
Posts: n/a
 
      08-24-2004
Hi Donald:

I agree that between the 3, Option A is in the direction to go...

Except I I understand you, I don't see how you are doing all the parts...

Your sentence "pass the object to the custom controls" totally works in terms of
a constructor that accepts args...but the IDE creates its controls via a
constructor that takes no args...
In other words, your code would work if working with dynamically created objects
all the time -- but I don't see how to get it to work with controls that work in
the IDE.

A case in point:

XRecord.dll
I made a dll that basically converts DB connections into objects -- a custom
O/R, and instead of DBconnections, etc. moves around XRecord derived objects (ie
if from a table called projects, called XProjects...)
Nice dll.

XForm.dll
Now I have a usercontrol that could take an XProject and convert it to/from an
input form that that builts itself automatically from the field names -- with a
little help from Attributes to know what type of input field to use.
Fine.

Compiling XForm.dll:
But if I want to make that usercontrol into a servercontrol it is going to need
a public property called XRecord -- of type XRecord --which is coming from a
separate dll.
The IDE won't let me compile it without ref to XRecord.dll --
ok. Willing to accept that.
Add a ref to XRecord.dll and compile.

Add it To IDE:
But if I then point the IDE to the AutoForm.dll and ask it to add it to the
ToolBox -- it takes AutoForm.dll and stores a copy somewhere -- maybe in
c:\program files\vstudio\toolbox or sommething -- but leaves behind the
XRecord.dll that AutoForm.dll was built pointing too...

Results:
So the icon will show -- but when I try to instantiate such a control by
dragging it from the toolbox onto the work area it refuses as the control
builder cannot instantiate the control -- ref to XRecord cannot be resolved in
DesignTime...



a) Where do I copy XRecord.dll to? Would this solve the problem? And it's hell
on trying to work like this if working on debugging /rebuilding
XForm.dll/XRecord.dll all the time...
b) How -- if that is what you are suggesting -- do you get the IDE to accept
refs to XRecord in a constructor?


Best,
Sky



"Donald Welker" <Donald.WelkerN0$SPAM@N0$SPAM.navy.mil> wrote in message
news:(E-Mail Removed)...
> OK, so you want several custom controls to use a shared common object that is
> rather large.
>
> Option A: Put the custom object in the parent's project and have the parent
> pass the object to the custom controls.
>
> Option B: Put the custom object in the GACL, which you say you can't do in
> which case you're stuck with your current solution, unless
>
> Option C: Write the shared code as a web service and call that, if you can
> get it to stand on its own.
>
> Personally I'm using Option A with some custom controls and it appears to be
> working for me.
>
> "S.Sigal" wrote:
>
> > Hello:
> >
> > Having trouble getting IDE to play nice/accept when designing Controls that

need
> > helper classes...
> >
> > I would like to compile controls as separate controls -- yet share some

common
> > 'helper' functions.
> >
> > How can I set up -- or get the equivalent workability of --
> >
> > CustomWebControl1\CustomWebControl1.sln
> > CustomWebControl2\CustomWebControl2.sln
> > CustomWebControl3\CustomWebControl3.sln
> > CustomCode\SharedCode.sln
> >
> > I tried this approach, with SharedCode being a Project Dependancy for each

of
> > the other three, and while that works in RunTime -- that fails in DesignTime
> > IDE. (It appears that when I add the Controls to the ToolBox the IDE copies

the
> > dlls pointed to -- but not any dependancies (!!!) -- to another directory

before
> > using it... In other words fails because it only has half of what it

needs).
> >
> > I understand that I could give SharedCode.dll a strong name and put it in

the
> > GACL -- and that might be possible on my computer -- but be impossible to do
> > with site where I am hosted.(no access to GACL).
> >
> >
> > Right now, I am cut/copying the helper functions in between assemblies...

which
> > is leading to it being hard to track down/correct bugs globally... And on

top of
> > that -- the helper functions are not small so massive code bloat.
> >
> > Anyone have an idea on how to make working on controls, without cut/pasting

code
> > all over the place?
> >
> > Thank you so much!
> > Sky
> >
> > PS:
> > (sorry for repost -- but help is urgently required...
> > Orig post at: microsoft.public.dotnet.framework.aspnet.webcontro ls)
> >
> >
> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can *common* struct-members of 2 different struct-types, that are thesame for the first common members, be accessed via pointer cast to either struct-type? John Reye C Programming 28 05-08-2012 12:24 AM
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
java.lang.NoSuchMethodError: wm.common.session.Common.getCustRptListFromMax Denny Java 1 05-01-2008 07:33 AM
How to share common code among pages in asp.net 2.0 just_life ASP .Net 0 08-01-2007 05:31 PM
Share common HTML code among different HTML files? MK HTML 6 05-15-2005 11:32 PM



Advertisments