What's the status of the partial properties? #52
Replies: 3 comments
-
|
Can you give an example of what you're looking for? Something like this? var input = """
public partial class Test : Notifiable
{
[Notify, AlsoNotify(nameof(BarName))]
public partial int Bar { get; set; }
public string BarName => Bar.ToString();
}
""";
// Generated Code - A633DA96-94D6-4448-BDD2-3D29E517E03F
var expectedSource = """
// <auto-generated>
// Auto-generated by Cornerstone.Generators
// </auto-generated>
partial class Test
{
private int _bar;
public partial int Bar
{
get => _bar;
set
{
if (!global::System.Collections.Generic.EqualityComparer<int>.Default.Equals(value, _bar))
{
OnPropertyChanging("Bar");
_bar = value;
OnPropertyChanged("Bar");
OnPropertyChanged("BarName");
}
}
}
}
""";
// Generated Code - /A633DA96-94D6-4448-BDD2-3D29E517E03F
ValidateSource(input, "Test", expectedSource, "A633DA96-94D6-4448-BDD2-3D29E517E03F"); |
Beta Was this translation helpful? Give feedback.
-
|
Yep, and you can modify partial with different access for getter and setter plus make it virtual if required. And you immediately see in code the property. Note: It doesn't auto insert BarName notification? Is this one of the things not implemented? |
Beta Was this translation helpful? Give feedback.
-
|
For me it's the currently awkward way of adding attributes as fully-qualified type strings. Partial properties would allow for: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Seems like the branch for partial properties has stalled. Is there a particural reason or just not enough resources?
To me partial properties seems an ideal fit for this source generator.
Beta Was this translation helpful? Give feedback.
All reactions