AssessmentModel
The component that receives the assessment data, and serializes it in a standard model.
Responsibilities
Receive tool-executions data
Receive code-describing data
Represent all data in a standard model
Serialize and deserialize data as needed
Resolve aggregation requirements in-memory
Minimize usage of memory and time resources
Provide a mechanism to traverse the data after the loading process finishes
(to support reports generation and show summary data)
Upload data to Mobilize.Net servers
Components:
AssessmentModelWriter: writes tool executions data and create the code model writer.
AssessmentModelReader: reads tools executions data and create the code model reader.
CodeModelWriter: writes the code describing data.
CodeModelReader: reads the code describing data.

AssessmentModelWriter
Used by the controller to create and populate the local data repository.
In charge of the upload process to our servers.
Provides the CodeModelWriter that will be passed to the Code Processor.
Allows loading data about the executed Controller and Code Processors, as well as their results and severe errors that are experienced.
public interface IAssessmentModelWriter : IDisposable
{
ICodeModelWriter CreateModelWriter(CodeProcessorDescriptor descriptor, Guid executionId);
void AddControllerError(string errorMessage, string exceptionType, string details);
void AddCodeProcessorError(CodeProcessorDescriptor descriptor, string errorMessage, string exceptionType, string details);
void FinalizeControllerExecution(ExecutionStatus executionStatus);
void FinalizeCodeProcessorExecution(CodeProcessorDescriptor descriptor, ExecutionStatus executionStatus);
void Upload();
}
CodeModelWriter
Provided by the AssessmentModelWriter and used by the Code Processor to load the data that describes the code.
public interface ICodeModelWriter : IDisposable
{
void AddFile(string filePath, string technology, FileKind fileKind, FileBinaryKind binaryKind, int bytes, SupportedStatus supportedStatus = SupportedStatus.DoesNotApply, ProcessedStatus processed = ProcessedStatus.DoesNotApply);
void AddProject(string path, string name, ProjectKind projectKind, SupportedStatus supported, ProcessedStatus processed);
void AddInventory(string inventoryName, params string[] additionalFieldsNames);
void AddInventoryEntry(string inventoryName, string element, string projectId, string fileId, int count, params string[] additionalFieldsValues);
void AddNotification(string code, string[] args, string projectId = null, string fileId = null, int? line = null, int? column = null);
void AddNotification(string code, string projectId = null, string fileId = null, int? line = null, int? column = null);
void AddLibraryElement(string libraryId, string declaringTypeId, string elementSignature, EntityKind entityKind, SupportByThen supportByThen, int count, string signatureAttribute = null, string referenceTypeId = null, string domain = null);
void AddCustomDataset(string name, string sourceFile);
void AddParseErrorEntry(string errorMessage, string file, int line, int column, int charCount, string nodeType = null);
void AddConversionRateEntry(string nodeType, ConversionResult conversionResult, int charCount, int occurrences = 1, ConversionResult? accumulatedResult = null, int? accumulatedCharCount = null);
void AddElement(string id, EntityKind kind, string fileId, string projectId, params KeyValuePair<string, string>[] elementProperties);
void AddElementProperty(string elementId, string name, string value);
void AddRelationship(string elementId1, string elementId2, RelationshipKind relKind, params KeyValuePair<string, string>[] relationshipProperties);
void AddRelationshipProperty(int relationshipId, string name, string value);
void AddWordCounts(string fileId, string keyword, int count);
void AddLineCounts(string fileId, LineKind lineKind, int count);
void AddFileInProjectEntry(string fileId, string projectId);
void AddExternalLibrary(string libraryId, string version, string friendlyName, string binaryName, LibraryKind kind);
void AddExternalLibraryReferences(string projectId, string externalLibraryId);
void AddCustomProperty(string name, string value);
void AddFingerprint(IFingerprint fingerprint);
}
AssessmentModelReader
After the data has been loaded and the execution process finished, the AssessmentModelReader can be used to read the data about the tool execution results and to get the CodeModelReader
public interface IAssessmentModelReader
{
ICodeModelReader CreateCodeModelReader(string codeProcessorName);
ProductSession GetProductSession();
IEnumerable<ExecutionError> ReadExecutionErrors();
IEnumerable<string> GetAllCodeModelNames();
IEnumerable<ICodeModelReader> CreateAllCodeModelReaders();
}
CodeModelReader
Used by the CodeProcessor to read the final data and create reports or other output data.
public interface ICodeModelReader
{
ToolExecution ReadToolExecution();
IEnumerable<AstConversionRateEntry> ReadAstConversions();
IEnumerable<FileInfoEntry> ReadFileEntries();
IEnumerable<InventoryEntry> ReadInventory(string inventoryName);
IEnumerable<string> ReadAdditionalFieldsOfInventory(string inventoryName);
IEnumerable<LibraryElementEntry> ReadLibraryElements();
IEnumerable<ProjectInfoEntry> ReadProjects();
IEnumerable<NotificationEntry> ReadNotifications();
IEnumerable<ParseErrorEntry> ReadParseErrors();
IEnumerable<ElementEntry> ReadElements();
IEnumerable<ElementPropertyEntry> ReadElementProperties();
IEnumerable<RelationshipEntry> ReadRelationships();
IEnumerable<RelationshipPropertyEntry> ReadRelationshipProperties();
IEnumerable<WordCountsEntry> ReadWordCounts();
IEnumerable<LineCountsEntry> ReadLineCounts();
IEnumerable<InternalProjectReference> ReadProjectReferences();
IEnumerable<string> ReadInventoryNames();
IEnumerable<FileInProjectEntry> ReadFileInProjectEntries();
IEnumerable<ExternalLibraryEntry> ReadExternalLibraries();
IEnumerable<ExternalLibraryReferenceEntry> ReadExternalLibrariesReferences();
IEnumerable<CustomProperty> ReadCustomProperties();
IFingerprint ReadFingerprint();
}
Model
The model is divided into two areas:
Execution Model:
Loaded by the controller
Contains data about the executed controller and code processors, its results and errors if any.
Contains telemetry data
Code Model
Loaded by the Code Processor
Contains data that describes the code, its projects, files, types, members, parsing errors, notifications, library elements usage, language migration coverage, etc.
Each code processor can load different parts of the model, depending on its capabilities to extract the data.
Execution Model

Code model

Explanation for some properties
CustomFile
It represents an attachment related to the Assessment Model. It is currently not supported.
LibraryElement
DeclaringTypeId
Corresponds to the declared type of the element. For instance, in an assignment such as "IEnumerable<string> names = new List<string>();" the declaring type will be IEnumerable<string>
ReferenceTypeId
Corresponds to the type of the referenced type. For instance, in an assignment such as "IEnumerable<string> names = new List<string>();" the referenced type will be List<string>
Domain
Indicates the technolog/domain of the element. Two example values can be xaml and cs, which indicate that the element corresponds to XAML and to C#, respectively.
Signature Attribute
Indicates the way in which an attribute works
Examples:
TwoWayBinding
OneWayBinding
Literal
Attached
ElementSignature
Indicates the name of the property that is being referenced
Examples:
Margin
Grid.Row
Pending Work
Custom Files must be added
Product Execution should include enough information to associate the execution to the client
ProductExecution.LicenseId should be the Active License during the execution
Review the need for Project Kind
Review if the SupportByThenKind and SupportStatusKind are equivalent (if they are, one of them could be removed)
Maybe the method used to Upload the DB can be optimized
It involves two parts
Assessment API class: Assessment Uploader (and other auxiliary classes)
Assessment DB stored procedure: LoadAssessmentModelFromTempTables
Maybe it will improve the performance if:
We created index for the temporal tables
Maybe it will be cleaner if:
We used table parameters
How to Populate the Code Model
Under Construction...
Last updated