public void GetMemberBindings(BindingBuilder builder) { var recordBluePrints = _sessionFactoryHolder.GetSessionFactoryParameters().RecordDescriptors; foreach(var member in _repository.Table.ToList()) { var record = recordBluePrints.FirstOrDefault(r => String.Equals(r.Type.FullName, member.Type, StringComparison.OrdinalIgnoreCase)); if (record == null) { continue; } var property = record.Type.GetProperty(member.Member, BindingFlags.Instance | BindingFlags.Public); if(property == null) { continue; } builder.Add(property, member.DisplayName, member.Description); } }
public void Describe(DescribeSortCriterionContext describe) { var builder = new BindingBuilder(); foreach(var bindingProvider in _bindingProviders) { bindingProvider.GetMemberBindings(builder); } var groupedMembers = builder.Build().GroupBy(b => b.Property.DeclaringType).ToDictionary(b => b.Key, b => b); foreach (var typeMembers in groupedMembers.Keys) { var descriptor = describe.For(typeMembers.Name, new LocalizedString(typeMembers.Name.CamelFriendly()), T("Members for {0}", typeMembers.Name)); foreach (var member in groupedMembers[typeMembers]) { var closureMember = member; descriptor.Element(member.Property.Name, member.DisplayName, member.Description, context => ApplyFilter(context, closureMember.Property), context => DisplaySortCriterion(context, closureMember.DisplayName.Text), SortCriterionFormProvider.FormName ); } } }
public void GetMemberBindings(BindingBuilder builder) { var recordBluePrints = _sessionFactoryHolder.GetSessionFactoryParameters().RecordDescriptors; foreach (var member in _repository.Table.ToList()) { var record = recordBluePrints.FirstOrDefault(r => String.Equals(r.Type.FullName, member.Type, StringComparison.OrdinalIgnoreCase)); if (record == null) { continue; } var property = record.Type.GetProperty(member.Member, BindingFlags.Instance | BindingFlags.Public); if (property == null) { continue; } builder.Add(property, member.DisplayName, member.Description); } }