Completed
Last Updated: 25 Oct 2022 09:04 by ADMIN
Release R3 2022 SP1
Currently, the RadEntityFrameworkCoreDataSource will work properly only in EF Core 3.1. Otherwise, the following error occurs when using the source with EF Core 5 or 6:
System.TypeLoadException: 'Could not load type 'Microsoft.EntityFrameworkCore.Query.Internal.IAsyncQueryProvider' from assembly 'Microsoft.EntityFrameworkCore, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.'
In case you need to use the Telerik EF support, you can use the QueryableEntityCoreCollectionView instead of RadEntityFrameworkCoreDataSource as shown in the MVVM Usage article.
Completed
Last Updated: 29 Apr 2022 14:19 by ADMIN
Release LIB 2022.1.502 (2 May 2022)

NullReferenceException is thrown with the following stacktrace when you initialize QueryableEntityCoreCollectionView.

at Telerik.Windows.Data.QueryableProxy`1.get_Count()
   at Telerik.Windows.Data.QueryableEntityCoreCollectionView`1.UpdateTotalItemCount()
   at Telerik.Windows.Data.QueryableCollectionView..ctor(IEnumerable sourceCollection, Type itemType)
   at Telerik.Windows.Data.QueryableCollectionView..ctor(IEnumerable source)
   at Telerik.Windows.Data.QueryableEntityCoreCollectionView`1..ctor(DbContext dbContext, IQueryable`1 query, Collection`1 include)

To work this around, you can create a custom QueryableEntityCoreCollectionView class and override its UpdateTotalItemCount() method.

public class CustomQueryableEntityCoreCollectionView<T> : QueryableEntityCoreCollectionView<T> where T : class, new()
{

	public CustomQueryableEntityCoreCollectionView(DbContext dbContext, IQueryable<T> query, Collection<string> include)
		: base(dbContext, query, include)
	{
	}

	protected override void UpdateTotalItemCount()
	{
		var sourceListProperty = typeof(QueryableCollectionView).GetProperty("SourceList", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
		var sourceList = (IList)sourceListProperty.GetValue(this);
		if (sourceList != null && !(sourceList is ICollectionView))
		{
			this.TotalItemCount = sourceList.Count;
		}
		else
		{
			var proxyProperty = typeof(QueryableEntityCoreCollectionView<T>).GetProperty("Proxy", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
			var proxy = proxyProperty.GetValue(this);
			if (proxy != null)
			{
				var dbSetProperty = proxy.GetType().GetProperty("DbSet");
				var dbSet = dbSetProperty.GetValue(proxy) as DbSet<T>;
				if (dbSet != null)
				{
					this.TotalItemCount = dbSet.Local.Count;
				}
				else
				{
					this.TotalItemCount = this.QueryableSourceCollection.Count();
				}
			}
		}
	}
}

Completed
Last Updated: 17 Oct 2022 11:02 by ADMIN
Release LIB 2022.3.1017 (17 Oct 2022)
A query for all items was sent to the server upon initializing a QueryableEntityCoreCollectionView