Skip to content

Clean Architecture Domain Data Bindings #15662

Closed Answered by LSXAxeller
LSXAxeller asked this question in Q&A
Discussion options

You must be logged in to vote

I just found that using System.ComponentModel and NotifyPropertyChanged in Domain isn't a UI code so it doesn't violate the concern of separation principles, I just did this and it's working

using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace CleanArchitectureUI.Domain.Entities;

public abstract class BaseEntity : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler? PropertyChanged;
    public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    public void Notify<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
    {
        field = value;
        …

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@stevemonaco
Comment options

@LSXAxeller
Comment options

Answer selected by LSXAxeller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants