是否有可能弱订阅using PrivateNameSpace.Common.EntityFramework;
using PrivateNameSpace.Data.DbContext;
using PrivateNameSpace.Data.Repos.Interfaces;
using Microsoft.EntityFrameworkCore;
using System.Data.SqlClient;
using System.Linq;
public class OrganizationRepository: Repository<Entities.Organization, int, OrganizationContext>, IOrganizationRepository
{
private const string storedProcedure = "dbo.sproc_organizations_by_userid";
public OrganizationRepository(OrganizationContext context) : base(context)
{
DbSet = Context.Organizations;
}
public IQueryable<Entities.Organization> GetOrganizationsByUserId(int userId)
{
var sql = $"{Sproc} @UserId";
var result = Context.Organizations.FromSql(sql, new SqlParameter("@UserId", userId));
return result;
}
}
事件?
UIElement.IsEnabledChanged
WeakEventManager<TEventSource, TEventArgs>
似乎起作用,因为WeakEventManager<UIElement, DependencyPropertyChangedEventArgs>
.AddHandler(uie, nameof(UIElement.IsEnabledChanged), Element_isEnabledChanged);
不扩展DependencyPropertyChangedEventArgs
。
也没有TEventArgs
PropertyChangedEventManager
之所以起作用,是因为PropertyChangedEventManager
.AddHandler(uie, Element_isEnabledChanged, nameof(UIElement.IsEnabled));
没有实现UIElement
!人们应该如何安全地订阅该活动?