PageRenderTime 11ms CodeModel.GetById 5ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/ResourceManagement.Client/DefaultResourceTypeFactory.cs

#
C# | 33 lines | 30 code | 3 blank | 0 comment | 2 complexity | 0a4ae5b307c836b36a1c718c9656f40c MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Text;
 4using Microsoft.ResourceManagement.ObjectModel;
 5using Microsoft.ResourceManagement.ObjectModel.ResourceTypes;
 6
 7namespace Microsoft.ResourceManagement.Client
 8{
 9    public class DefaultResourceTypeFactory : IResourceTypeFactory
10    {
11        #region IResourceTypeFactory Members
12
13        public virtual RmResource CreateResource(string resourceType)
14        {
15            if (String.IsNullOrEmpty(resourceType))
16            {
17                return new RmResource();
18            }
19            String upperCaseResourceType = resourceType.ToUpperInvariant();
20            switch (upperCaseResourceType)
21            {
22                case @"GROUP":
23                    return new RmGroup();
24                case @"PERSON":
25                    return new RmPerson();
26                default:
27                    return new RmResource();
28            }
29        }
30
31        #endregion
32    }
33}