Beispiel #1
0
        public SystemResource CreateResource(ModuleType moduleType, string description)
        {
            if (Resources.Any(x => x.ModuleType == moduleType))
            {
                throw new Exception("A resource already exists for module type: " + moduleType);
            }

            var resource = new SystemResource(moduleType, description);

            ResourceCollection.Add(resource);
            return(resource);
        }
Beispiel #2
0
        public SystemResource CreateResource(ModuleType moduleType, string description)
        {
            // Is the resource already created
            var systemResource = GetResource(moduleType);

            if (systemResource != null)
            {
                return(systemResource);
            }

            // Create a new one.
            var resource = new SystemResource(moduleType, description);

            ResourceCollection.Add(resource);
            return(resource);
        }