Skip to content
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

Attribute mapping added #13

Merged
merged 3 commits into from
Nov 25, 2021

Conversation

Wulfheart
Copy link

Hello,
I wanted to map specific properties. For example a name = "Something" should be mapped to public string Name. This can be achieved like this:

[user]
name = "User1"
password = "PW"
using Tomlet;
public class Config
{
    [TomlProperty("user")]
    public User User { get; set; }
}

public class User
{
    [TomlProperty("name")]
    public string Name { get; set; }
    [TomlProperty("password")]
    public string Password { get; set; }
} 

Currently I made it available under https://www.nuget.org/packages/Wulfheart.Tomlet/2.1.0 until it gets eventually merged.

@SamboyCoding
Copy link
Owner

Looks good, the only question I would have is if you could possibly add some unit tests to validate this behaviour? Then I will gladly merge this.

@SamboyCoding
Copy link
Owner

Actually, ignore that, the test failed, you need to use FirstOrDefault instead of First

Tomlet/TomlSerializationMethods.cs Outdated Show resolved Hide resolved
@Wulfheart
Copy link
Author

Thanks for your comments.

How can I run the tests locally with the CLI or Rider? Anywhere to look?

@SamboyCoding
Copy link
Owner

Rider should pick up the tests automatically, if you go to the Unit Tests tool window (View -> Tool Windows -> Unit Tests). Alternatively, the command is dotnet test from the solution folder

@Wulfheart
Copy link
Author

@SamboyCoding Added tests and serialization also works now.

@SamboyCoding
Copy link
Owner

The build is failing because the resx file hasn't been recompiled, but I'll trust you if you say it works now, and the changes look like they make sense, I'll merge this in a bit and recompile the resx myself, then push to nuget.

@Wulfheart
Copy link
Author

image

😉

Thank you! I'm looking forward to it.

@SamboyCoding SamboyCoding merged commit 5c98192 into SamboyCoding:master Nov 25, 2021
@Wulfheart
Copy link
Author

Thanks for merging. Is there already a release on Nuget?

@SamboyCoding
Copy link
Owner

Not yet, but I'm working on it now. Got one issue to fix then I'll publish and update you here

@SamboyCoding
Copy link
Owner

@Wulfheart The build is now validating on nuget - I anticipate it becoming available within 5-10 minutes.

@Wulfheart Wulfheart deleted the feature/annotations branch November 25, 2021 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants