ExtensionAttribute.cs :  » Bloggers » BlogEngine.NET » BlogEngine.Core » Web » Controls » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Bloggers » BlogEngine.NET 
BlogEngine.NET » BlogEngine.Core » Web » Controls » ExtensionAttribute.cs
using System;

namespace BlogEngine.Core.Web.Controls{
  /// <summary>
  /// All extensions must decorate the class with this attribute.
  /// It is used for reflection.
  /// <remarks>
  /// When using this attribute, you must make sure
  /// to have a default constructor. It will be used to create
  /// an instance of the extension through reflection.
  /// </remarks>
  /// </summary>
  [AttributeUsage(AttributeTargets.Class)]
  public sealed class ExtensionAttribute : Attribute
  {
    /// <summary>
    /// Creates an instance of the attribute and assigns a description.
    /// </summary>
    public ExtensionAttribute(string description, string version, string author)
    {
      _Description = description;
      _Version = version;
      _Author = author;
    }

    /// <summary>
    /// Creates an instance of the attribute and assigns a description.
    /// </summary>
    public ExtensionAttribute(string description, string version, string author, int priority)
    {
        _Description = description;
        _Version = version;
        _Author = author;
        _priority = priority;
    }

    private string _Description;
    /// <summary>
    /// Gets the description of the extension.
    /// </summary>
    public string Description
    {
      get { return _Description; }
    }

    private string _Version;

    /// <summary>
    /// Gets the version number of the extension
    /// </summary>
    public string Version
    {
      get { return _Version; }
    }

    private string _Author;

    /// <summary>
    /// Gets the author of the extension
    /// </summary>
    public string Author
    {
      get { return _Author; }
    }

    private int _priority;

    /// <summary>
    /// Gets the priority of the extension
    /// This determins in what order extensions instantiated
    /// and in what order they will respond to events
    /// </summary>
    public int Priority
    {
        get { return _priority; }
    }

  }

  /// <summary>
  /// Helper class for sorting extensions by priority
  /// </summary>
  public class SortedExtension
  {
      /// <summary>
      /// Order in which extensions are sorted and respond to events
      /// </summary>
      public int Priority;
      /// <summary>
      /// Name of the extension
      /// </summary>
      public string Name;
      /// <summary>
      /// Type of the extension
      /// </summary>
      public string Type;
      /// <summary>
      /// Constructor
      /// </summary>
      /// <param name="p">Priority</param>
      /// <param name="n">Name</param>
      /// <param name="t">Type</param>
      public SortedExtension(int p, string n, string t)
      {
          Priority = p;
          Name = n;
          Type = t;
      }
  }    
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.