Share common code when developing single Control assemblies?

Discussion in 'ASP .Net Building Controls' started by S.Sigal, Aug 21, 2004.

  1. S.Sigal

    S.Sigal Guest

    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.Sigal, Aug 21, 2004
    #1
    1. Advertising

  2. S.Sigal

    S.Sigal Guest

    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:...
    > 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.webcontrols)
    > >
    > >
    > >
    > >
    > >
    S.Sigal, Aug 24, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Param R.

    common assemblies

    Param R., Oct 7, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    388
    Param R.
    Oct 8, 2004
  2. MK
    Replies:
    6
    Views:
    688
    noSpAm0000
    May 16, 2005
  3. just_life
    Replies:
    0
    Views:
    683
    just_life
    Aug 1, 2007
  4. Sky Sigal

    Desperate: share base classes/methods across control assemblies?

    Sky Sigal, Aug 4, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    140
    Sky Sigal
    Aug 4, 2005
  5. Saraswati lakki
    Replies:
    0
    Views:
    1,322
    Saraswati lakki
    Jan 6, 2012
Loading...

Share This Page