I am working on a Web Application that can dynamically load
UserControls, a la a plugin style system. When I create any new
controls within the project, all is fine.
What my question is, would be how might I be able to allow someone to
create a plugin that would not require that I rebuild the application -
or is it even possible? Right now, this is what I have:
A BasePage class that inherits from System.Web.UI.P age that is used to
extend the Page object for extended rendering functionality.
A BaseControl class that inherits from System.Web.UI.U serControl that
is used to extend the UserControl object for specific rendering
capabilities that are used by all plugins.
I have a page that inherits from BasePage. To it, I've added a
PlaceHolder control. Then on Page_Load, I simply use LoadControl to
load the specific control and add it to the PlaceHolder. My ultimate
goal would be to build up a repository of these objects in a database
so that I could configure certain controls to be used in certain
situations. Basically, it is a CMS-type application.
Like I mentioned, as long as the control exists in the main project,
all is well. But assume that a third party wants to develop a plugin.
I don't want to give access to the code to that person, for obvious
reasons.
Are my options limited to adding the DLL from the plugin to the /bin
folder of the main application? After I do that, how do I get the
application to recongize the DLL? If I put them in a subfolder
structure to keep them organized, does this impact anything in regards
to the ability to load the control?
Thank you, in advance, for any input.
Joseph 1 1229
I have made some progress. What I am doing now, instead of
LoadControl, is I am creating a reference to the Assembly by using
Assembly.LoadFr om(). I then cast it to the correct control type and
assign it to the control collection of a placeholder on the calling
page. This is what I have in my Page_Load on the ASPX page:
Dim MyPlaceHolder As PlaceHolder =
CType(Me.FindCo ntrol("Template Holder"), PlaceHolder)
If Not MyPlaceHolder Is Nothing Then
Dim DynamicASM As [Assembly]
DynamicASM =
DynamicASM.Load From(Server.Map Path("./New/bin/New.dll"))
Dim ControlInstance As MyLib.Page.Cont rols.Template =
CType(DynamicAS M.CreateInstanc e("New.Index" ),
MyLib.Page.Cont rols.Template)
MyPlaceHolder.C ontrols.Add(Con trolInstance)
ControlInstance .TestOutput()
End If
The TestOutput() method is defined in the base control instance, and
outputs "Base" to the screen when called, if it is not overriden. I
override it in the derived instance to display "Derived". When I run
the above code, it displays "Derived". But now, my new problem...
Any content in the derived control is not displayed. For example, I
added a table in the designer and recompiled. The instance I create
from the assembly is displaying "Derived", so it is creating it. The
events of the derived control are also being hit correctly, if I add
breakpoints in the debugger. I just can't get the table to show. I am
assuming that something is happening in LoadControl that this approach
does not do.
Does anyone have any idea as to might what be going on, or have a
better approach to this? I am feeling a little lost at the moment.
;-)
Thanks!
Joseph This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chua Wen Ching |
last post by:
Hi there,
I had some doubts on creatings plugins.
As most example on the internet shows how to write plugins onto a plugin
host which is normally a windows form program.
1) Can i replace plugin host as class libraries instead of windows forms
program?
|
by: Tamir Khason |
last post by:
Friends, maybe someone knows good references for .NET plugin based program
architecture. E.g I want to be able to "put" class library(dll) in some
place (where I do not the name of the class, but only structure ) and use it "plug-and-play" in main procedure without
recompilation
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
|
by: Matt |
last post by:
I'm hoping someone can steer me in the right direction to try to do the
following:
I am developing an application where we receive files from customers. Right
now we receive a variety of formats. I was looking at writing some type of
base application that would allow me to add-in either new assemblies or
plugins, don't know how or which way, for different scenarios. We may
just recieve a text file so an assembly would handle...
|
by: CSharpNewBie |
last post by:
Hi
I am looking to create a Plugin Architecture. I looked at this extend or
enhance the User Interface (UI) article
http://www.codeproject.com/csharp/extensibleui.asp
and It looks good and I would like to know if any better way to do.
My requirements are
I have several screens and each screen will have grid with data and thinking
of putting each screen in a PlugIn(assembly) and loading it in a Container..
|
by: rodchar |
last post by:
Hey all,
I'm trying to understand Master/Detail concepts in VB.NET. If I do a data
adapter fill for both customer and orders from Northwind where should that
dataset live?
What client is responsible for instantiating the orders class? Would it be
the ui layer or the master class in the business layer?
thanks,
| |
by: rudolf.ball |
last post by:
Dear NG,
I have a question about the architecture of my ASP.NET 2.0 site:
Users can have custom features, I call it plugins. A plugin can be
UserAdministration, ProductAdministration, Payments, ...
Each plugin is realized by one or more sites.
Now, each users can use different plugins, eg.
|
by: Olie |
last post by:
I was quite surprised to find virtually nothing about this but I may
have been searching for the wrong thing.
I want to know the best way to provide a programming interface to a
plugin. I already have a plugin architecture that allows the
application to call code in a plugin but I want the plugin to also be
able to call code in the application.
I can think of many ways to do this but I am not sure the best way:
|
by: =?UTF-8?B?R3J6ZWdvcnogU8WCb2Rrb3dpY3o=?= |
last post by:
I'm working on my little project (an IM client) which I wanted to
support plugins. My idea was that the core program would by itself do
virtually nothing but manage plugins and all functionality would be
provided by the plugins themselves (including protocol handling and UI.
My first attempt was to check a directory for *.py files, execfile()
them and rely on them to call a method to register a plugin object. This
approach led to some...
|
by: jmDesktop |
last post by:
I'm using C#, but I don't know that it matters for this question. I
know that many experienced folks are on here, so sorry for being off
topic. I am finally at a point where I want to and I think able to
design software that is modular and pluggable. The only problem is
that I'm not sure if I need to or if this lends itself to it.
I have a project that requires building a scheduler. It's more of a
virtual take number program as in...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |