| Name | Latest Version |
|---|---|
| C# strongly-typed resources and helper classes generators | 1.1 |
Description
Set of scripts to create C# wrappers for strongly-typed resources (RmPerson, RmGroup etc) and other helper classes, reading types and attributes definitions in FIM.Requirements
To run the scripts you needfim-resource - added in version 1.1
Creates a C# file with the definition of a strongly typed resource, i.e. a class extending RmResource for a particular FIM resource definition. The scripts reads the type definition from the FIM schema and then expands some templates, which are text files located under the "fim-resource-templates" folder.public virtual RmResource CreateResource(string resourceType) {
if (String.IsNullOrEmpty(resourceType)) {
return new RmResource();
}
String upperCaseResourceType = resourceType.ToUpperInvariant();
switch (upperCaseResourceType) {
case @"GROUP":
return new RmGroup();
case @"PERSON":
return new RmPerson();
// add this case statement to add support for strongly-typed sets.
case @"SET":
return new RmSet();
default:
return new RmResource();
}
}
For more details, you can have a look at this post.public partial class RmPerson : RmResource {
public string AccountName {
get {
return GetString(AttributeNames.AccountName);
}
set {
base[AttributeNames.AccountName].Value = value;
}
}
public DateTime? EmployeeStartDate {
get {
return GetNullable<DateTime>(AttributeNames.EmployeeStartDate);
}
set {
base[AttributeNames.EmployeeStartDate].Value = value;
}
}
// more attributes and code...
fim-attribute-names
Creates a C# file containing a class with constants for FIM attribute names.public static class AttributeNames {
/// <summary>
/// Account Name
/// User's log on name
/// </summary>
public const string AccountName = "AccountName";
// more attributes...
}
fim-attribute-values
Creates a C# file containing classes with constants for FIM attribute values; the attributes considered are those having a validation string (StringRegex attribute) in the form ^(value1|value2|valueN)$.public static class EmployeeTypeValues {
public const string EmptyEmployeeType = "";
public const string Contractor = "Contractor";
public const string Intern = "Intern";
public const string FullTimeEmployee = "Full Time Employee";
}
fim-type-names
Creates a C# file containing a class with constants for FIM type names.public static class TypeNames {
/// <summary>
/// User
/// This resource defines applicable policies to manage incoming requests.
/// </summary>
public const string Person = "Person";
// more definitions...
}
Usage
All the script display an help message if invoked with the -help switch.Download
To download this script, use this link.
To get to the FIM ScriptBox, use this link.