What's the status of the partial properties? #52
Unanswered
MihaMarkic
asked this question in
Q&A
Replies: 2 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.
0 replies
-
|
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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