Bonjour.

J'ai commencé à apprendre le c# et donc j'ai décidé de développer un erp.
Sur un mode de fonctionnent de plugins, j'ai réalisé mon interface définissant les bases de chaque plugins.

J'ai réalisé un petit plugin Hellworld qui retourne un simple label dans la page web.
Code C# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using Plugins.Interfaces;
 
namespace HelloWorldPlugin
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:HelloWorldCustomControl runat=server></{0}:HelloWorldCustomControl>")]
    public class HelloWorldCustomControl : WebControl
    {
 
        // Label Component
        private Label _helloworldLabel;
 
        public override ControlCollection Controls
        {
            get
            {
                EnsureChildControls();
                return base.Controls;
            }
        }
 
        protected override void CreateChildControls()
        {
            Controls.Clear();
 
            base.CreateChildControls();
 
            //create & add Label control
            InitializeHelloWorldLabel();
            this.Controls.Add(_helloworldLabel);
        }
 
        protected override void Render(HtmlTextWriter output_)
        {
            CreateChildControls();
 
            _helloworldLabel.RenderControl(output_);
        }
 
        /// <summary>
        /// Hello World label
        /// </summary>
        /// <returns></returns>
        public void  InitializeHelloWorldLabel()
        {
            _helloworldLabel = new Label()
            {
                ID = "helloworldlabel",
                Text = "Hello World",
            };
        }
 
        public HelloWorldCustomControl()
        {
            Plugin = null;
            PluginHost = null;
        }
 
        public IPluginHost PluginHost { get; set; }
 
        public IPlugin Plugin { get; set; }
    }
}

J'initialise le contrôle dans Render(HtmlTextWriter output_), mais je doute que la méthode soit la bonne.
Avez vous d'autres manières de procéder ?

Merci.