private static ColumnsFactory SelectColumnsFactoryFor(Resource resource) { WindowsAzureActiveDirectoryGroup group = resource as WindowsAzureActiveDirectoryGroup; if (group != null) { ColumnsFactory result = new GroupColumnsFactory(group); return(result); } Core2EnterpriseUser user = resource as Core2EnterpriseUser; if (user != null) { ColumnsFactory result = new UserColumnsFactory(user); return(result); } DynamicUser dynamicUser = resource as DynamicUser; if (dynamicUser != null) { ColumnsFactory result = new DynamicUserColumnsFactory(dynamicUser); return(result); } string unsupportedSchema = string.Join( Environment.NewLine, resource.Schemas); throw new NotSupportedException(unsupportedSchema); }
private static IReadOnlyDictionary <string, string> PatchUser(PatchRequest2 patch, IRow row) { ResourceFactory <Core2EnterpriseUser> userFactory = new UserFactory(row); Core2EnterpriseUser user = userFactory.Create(); user.Apply(patch); ColumnsFactory <Core2EnterpriseUser> userColumnsFactory = new UserColumnsFactory(user); IReadOnlyDictionary <string, string> result = userColumnsFactory.CreateColumns(); return(result); }