예제 #1
0
        /// <summary>
        /// Returns the metadata for a PluginController
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        internal static PluginControllerMetadata GetMetadata(Type type)
        {
            if (!TypeHelper.IsTypeAssignableFrom <PluginController>(type))
            {
                throw new InvalidOperationException("Cannot get metadata from a type that is not a PluginController");
            }

            PluginControllerMetadata meta;

            if (MetadataStorage.TryGetValue(type, out meta))
            {
                return(meta);
            }

            var attribute = type.GetCustomAttribute <PluginControllerAttribute>(false);

            meta = new PluginControllerMetadata()
            {
                AreaName            = attribute == null ? null : attribute.AreaName,
                ControllerName      = ControllerExtensions.GetControllerName(type),
                ControllerNamespace = type.Namespace,
                ControllerType      = type
            };

            MetadataStorage.TryAdd(type, meta);

            return(meta);
        }
예제 #2
0
        /// <summary>
        /// Returns the metadata for a PluginController
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        internal static PluginControllerMetadata GetMetadata(Type type)
        {
            return(MetadataStorage.GetOrAdd(type, type1 =>
            {
                var attribute = type.GetCustomAttribute <PluginControllerAttribute>(false);

                var meta = new PluginControllerMetadata()
                {
                    AreaName = attribute == null ? null : attribute.AreaName,
                    ControllerName = ControllerExtensions.GetControllerName(type),
                    ControllerNamespace = type.Namespace,
                    ControllerType = type
                };

                MetadataStorage.TryAdd(type, meta);

                return meta;
            }));
        }
        /// <summary>
        /// Returns the metadata for a PluginController
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        internal static PluginControllerMetadata GetMetadata(Type type)
        {
            return(MetadataStorage.GetOrAdd(type, type1 =>
            {
                var pluginAttribute = type.GetCustomAttribute <PluginControllerAttribute>(false);
                //check if any inherited class of this type contains the IsBackOffice attribute
                var backOfficeAttribute = type.GetCustomAttribute <IsBackOfficeAttribute>(true);

                var meta = new PluginControllerMetadata()
                {
                    AreaName = pluginAttribute == null ? null : pluginAttribute.AreaName,
                    ControllerName = ControllerExtensions.GetControllerName(type),
                    ControllerNamespace = type.Namespace,
                    ControllerType = type,
                    IsBackOffice = backOfficeAttribute != null
                };

                MetadataStorage.TryAdd(type, meta);

                return meta;
            }));
        }
예제 #4
0
		/// <summary>
		/// Returns the metadata for a PluginController
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		internal static PluginControllerMetadata GetMetadata(Type type)
		{
			if (!TypeHelper.IsTypeAssignableFrom<PluginController>(type))
			{
				throw new InvalidOperationException("Cannot get metadata from a type that is not a PluginController");
			}

			PluginControllerMetadata meta;
			if (MetadataStorage.TryGetValue(type, out meta))
			{
				return meta;
			}

			var attribute = type.GetCustomAttribute<PluginControllerAttribute>(false);

			meta = new PluginControllerMetadata()
			{
				AreaName = attribute == null ? null : attribute.AreaName,
				ControllerName = ControllerExtensions.GetControllerName(type),
				ControllerNamespace = type.Namespace,
				ControllerType = type
			};

			MetadataStorage.TryAdd(type, meta);

			return meta;
		}
예제 #5
0
		/// <summary>
		/// Returns the metadata for a PluginController
		/// </summary>
		/// <param name="type"></param>
		/// <returns></returns>
		internal static PluginControllerMetadata GetMetadata(Type type)
		{
            
		    return MetadataStorage.GetOrAdd(type, type1 =>
		        {
                    var attribute = type.GetCustomAttribute<PluginControllerAttribute>(false);

                    var meta = new PluginControllerMetadata()
                    {
                        AreaName = attribute == null ? null : attribute.AreaName,
                        ControllerName = ControllerExtensions.GetControllerName(type),
                        ControllerNamespace = type.Namespace,
                        ControllerType = type
                    };

                    MetadataStorage.TryAdd(type, meta);

                    return meta;
		        });

		}