Example #1
0
        private async Task <PageBlockTypeFileDetails> GetAndValidateBlockTypeFileDetails(
            string fileName,
            IPageBlockTypeDataModel dataModel,
            IExecutionContext executionContext
            )
        {
            PageBlockTypeFileDetails fileDetails;

            try
            {
                var query = new GetPageBlockTypeFileDetailsByFileNameQuery(fileName);
                fileDetails = await _queryExecutor.ExecuteAsync(query, executionContext);
            }
            catch (FileNotFoundException ex)
            {
                var dataModelType = dataModel.GetType();

                var message =
                    $"Cannot update registration for block type '{fileName}' because the view file could not be found. "
                    + "If you have removed the data model type and are still seeing this error, you may need to rebuild your solution to force the assemblies to update. See issue #357. "
                    + Environment.NewLine
                    + Environment.NewLine
                    + $"The corresponding data model type is '{dataModelType.FullName}' in assembly '{dataModelType.Assembly.FullName}' at '{dataModelType.Assembly.Location}'";
                throw new FileNotFoundException(message, ex.FileName, ex);
            }

            DetectDuplicateTemplateFileNames(fileDetails);

            return(fileDetails);
        }
 private string FormatBlockTypeFileName(IPageBlockTypeDataModel m)
 {
     return(_blockTypeFileNameFormatter.FormatFromDataModelType(m.GetType()));
 }