private IEnumerable <StandardizedResourceProfileData> GetStandardizedResourceProfileData() { if (ProjectHasProfileDefinition) { return(ProfileResourceNamesProvider .GetProfileResourceNames() .Select(prn => prn.ProfileName) .Distinct() .Select( profileName => ProfileResourceModelProvider.GetProfileResourceModel(profileName)) .SelectMany( prm => prm.Resources.Select( pct => new StandardizedResourceProfileData { Readable = pct.Readable, Writable = pct.Writable, ProfileName = prm.ProfileName })) .OrderBy(spd => spd.ProfileName.ToLower()) .ThenBy(x => x.ResolvedResource.Name)); } return(ResourceModelProvider.GetResourceModel() .GetAllResources() .Where(r => !r.IsAbstract() && TemplateContext.ShouldRenderResourceClass(r)) .OrderBy(x => x.Name) .Select( resource => new StandardizedResourceProfileData { Readable = resource, Writable = resource, ProfileName = null }) .OrderBy(x => x.ResolvedResource.Name)); }
protected override void Configure() { var validatingProfileMetadataProvider = new ValidatingProfileMetadataProvider(TemplateContext.ProjectPath, ResourceModelProvider); ProfileResourceNamesProvider = validatingProfileMetadataProvider; ProfileResourceModelProvider = new ProfileResourceModelProvider(ResourceModelProvider, validatingProfileMetadataProvider); ProjectHasProfileDefinition = validatingProfileMetadataProvider.HasProfileData; }
private IEnumerable <ProfileResourceModel> GetProfileResourceModels() { return(ProfileResourceNamesProvider .GetProfileResourceNames() .Select(prn => prn.ProfileName) .Distinct() .Select( profileName => ProfileResourceModelProvider.GetProfileResourceModel(profileName))); }
public object Generate(TemplateContext templateContext) { TemplateContext = Preconditions.ThrowIfNull(templateContext, nameof(templateContext)); ResourceModelProvider = new ResourceModelProvider(TemplateContext.DomainModelProvider); ValidatingProfileMetadataProvider = new ValidatingProfileMetadataProvider(TemplateContext.ProjectPath, ResourceModelProvider); ProfileResourceNamesProvider = ValidatingProfileMetadataProvider; ProfileResourceModelProvider = new ProfileResourceModelProvider(ResourceModelProvider, ValidatingProfileMetadataProvider); ProjectHasProfileDefinition = ValidatingProfileMetadataProvider.HasProfileData; Configure(); return(Build()); }