private void InitModelData() { modelData = new JObject(); // inject data var accessRoles = Reflective.GetConstants <string>(typeof(AccessRoles)); var fieldTypes = Reflective.GetConstants <string>(typeof(ElasticFieldTypes)); JsonHelper.AddOrSet(modelData, "accessRoles", JObject.FromObject(accessRoles)); JsonHelper.AddOrSet(modelData, "fieldTypes", JObject.FromObject(fieldTypes)); // types var types = JsonHelper.GetTokenValue <JObject>(modelData, TypesKey, true); if (types != null) { foreach (JProperty property in types.Children()) { var t = ModelType.CreateFrom(property); typesByNameCamelCased[t.Name.ToLowerCamelCase()] = t; } } // templates foreach (var template in TemplateDefinitions.Templates) { var t = ModelType.CreateFrom(template); typesByNameCamelCased[t.Name.ToLowerCamelCase()] = t; } // setup Super foreach (var type in typesByNameCamelCased.Values) { var superName = (type.SuperName ?? string.Empty).ToLowerCamelCase(); if (!string.IsNullOrEmpty(superName) && typesByNameCamelCased.ContainsKey(superName)) { type.Super = typesByNameCamelCased[superName]; } } }