fiseni / SmartAnnotations

A library for .NET that uses source generators to automatically generate data annotations for your models.
MIT License
53 stars 5 forks source link

Not Working at all for Net6.0 Project #3

Open TorreyGarland opened 2 years ago

TorreyGarland commented 2 years ago

Absolutely no code is generated.

Followed the instructions.

I have an EditViewModel:

public partial class EditViewModel
{
    [Reactive]
    public string Email { get; set; } = string.Empty;

    [Reactive]
    public string? Comment { get; set; }

    [Reactive]
    public bool IsApproved { get; set; }

    [Reactive]
    public bool IsLockedOut { get; set; }

    [ObservableAsProperty]
    public Roles Roles { get; }

    [Reactive]
    public IReadOnlyList<Roles> SelectedRoles { get; set; }
        = Array.Empty<Roles>();

    public ICommand Submit { get; }

    public ICommand Unlock { get; }

    public Interaction<Unit, bool> Validating { get; }
        = new();
}

and a EditModelAnnotator:

public class EditViewModelAnnotator : Annotator<EditViewModel>
{
    public EditViewModelAnnotator()
    {
        DefineFor(x => x.Email).Display().Name("Email");

        DefineFor(x => x.SelectedRoles).Display().Name("Roles");
    }
}

and my CSProj file: Screenshot 2022-06-05 222130

fiseni commented 2 years ago

Hey @TorreyGarland,

Yes, that's true, there are some changes in .NET6. I'll cross-check soon and publish a fix. But, still would be a beta version. This is the issue #1 that holds me back from publishing a release.