-
-
Notifications
You must be signed in to change notification settings - Fork 6
type providers #469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type providers #469
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "generator":{ | ||
| "name":"Maestria.TypeProviders", | ||
| "nuget":[ | ||
| "https://www.nuget.org/packages/Maestria.TypeProviders/" | ||
| ], | ||
| "link":"https://github.com/MaestriaNet/TypeProviders", | ||
| "author":"Fábio Monteiro Naspolini", | ||
| "source":"https://github.com/MaestriaNet/TypeProviders" | ||
| }, | ||
| "data":{ | ||
| "goodFor":["Generating strong typed code from Excel."], | ||
| "csprojDemo":"DemoExcel.csproj", | ||
| "csFiles":["Program.cs","MyExcelPerson.cs","Person.cs"], | ||
| "excludeDirectoryGenerated":[""], | ||
| "includeAdditionalFiles":[""] | ||
| }, | ||
| "links":{ | ||
| "blog":"", | ||
| "video":"" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <Solution> | ||
| <Project Path="DemoExcel/DemoExcel.csproj" /> | ||
| </Solution> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="ClosedXML" Version="0.105.0" /> | ||
| <PackageReference Include="Maestria.Extensions" Version="3.7.2.0" /> | ||
| <PackageReference Include="Maestria.TypeProviders" Version="1.3.1"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| </PackageReference> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Update="MyExcel.xlsx"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| </None> | ||
| </ItemGroup> | ||
|
|
||
| <PropertyGroup> | ||
| <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> | ||
| <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath> | ||
| </PropertyGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| namespace DemoExcel; | ||
|
|
||
| public partial class MyExcelPerson | ||
| { | ||
| public string FullName() => $"{FirstName} {LastName}"; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,10 @@ | ||||||
| using System; | ||||||
| using System.Collections.Generic; | ||||||
| using System.Text; | ||||||
|
|
||||||
| namespace DemoExcel; | ||||||
|
|
||||||
| [ExcelProvider(TemplatePath = @"MyExcel.xlsx")] | ||||||
| public partial class MyExcelPerson | ||||||
|
||||||
| public partial class MyExcelPerson | |
| public partial class Person |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,10 @@ | ||||||||||||||||||
| using DemoExcel; | ||||||||||||||||||
|
|
||||||||||||||||||
| Console.WriteLine("Hello, World!"); | ||||||||||||||||||
| var persons = MyExcelPersonFactory.Load("MyExcel.xlsx").ToArray(); | ||||||||||||||||||
|
Comment on lines
+2
to
+4
|
||||||||||||||||||
| Console.WriteLine("Hello, World!"); | |
| var persons = MyExcelPersonFactory.Load("MyExcel.xlsx").ToArray(); | |
| using System.IO; | |
| Console.WriteLine("Hello, World!"); | |
| var excelPath = Path.Combine(AppContext.BaseDirectory, "MyExcel.xlsx"); | |
| var persons = MyExcelPersonFactory.Load(excelPath).ToArray(); |
Copilot
AI
Apr 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output concatenates person.ID and person.FullName() without any delimiter, which makes the demo output hard to read (e.g., 1John Doe). Consider using string interpolation / formatting to include a separator (space, :, etc.) between the fields.
| Console.WriteLine(person.ID + person.FullName()); | |
| Console.WriteLine($"{person.ID}: {person.FullName()}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
System,System.Collections.Generic, andSystem.Textusings are currently unused in this file. Removing them avoids unnecessary clutter and prevents unused-using warnings in stricter build configurations.