Share common code when developing single Control assemblies?

S

S.Sigal

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.webcontrols)
 
S

S.Sigal

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top