public static Dictionary <DMSType, ModelCode> GetTypeToModelCodeMap() { Dictionary <DMSType, ModelCode> d = new Dictionary <DMSType, ModelCode>(TypeIdsInInsertOrder.Length); foreach (ModelCode mc in Enum.GetValues(typeof(ModelCode))) { DMSType type = ModelCodeHelper.GetTypeFromModelCode(mc); if (ModelCodeHelper.IsClass(mc) && type != 0) { d.Add(type, mc); } } return(d); }
public static Dictionary <DMSType, List <ModelCode> > GetTypeToPropertiesMap() { Dictionary <DMSType, List <ModelCode> > d = new Dictionary <DMSType, List <ModelCode> >(TypeIdsInInsertOrder.Length); Dictionary <DMSType, ModelCode> typeToMC = new Dictionary <DMSType, ModelCode>(); List <ModelCode> abstractType = new List <ModelCode>(); foreach (DMSType type in TypeIdsInInsertOrder) { d.Add(type, new List <ModelCode>()); } foreach (ModelCode mc in Enum.GetValues(typeof(ModelCode))) { DMSType type = ModelCodeHelper.GetTypeFromModelCode(mc); if (ModelCodeHelper.IsProperty(mc)) { (type == 0 ? abstractType : d[type]).Add(mc); } else if (type != 0) { typeToMC.Add(type, mc); } } foreach (ModelCode mc in abstractType) { foreach (KeyValuePair <DMSType, List <ModelCode> > type in d) { if (ModelCodeHelper.ModelCodeClassIsSubClassOf(typeToMC[type.Key], mc)) { type.Value.Add(mc); } } } return(d); }