IInstantFeedbackSource <TProjection> IUnitOfWorkFactory <TUnitOfWork> .CreateInstantFeedbackSource <TEntity, TProjection, TPrimaryKey>( Func <TUnitOfWork, IRepository <TEntity, TPrimaryKey> > getRepositoryFunc, Func <IRepositoryQuery <TEntity>, IQueryable <TProjection> > projection) { var threadSafeProperties = new TypeInfoProxied(TypeDescriptor.GetProperties(typeof(TProjection)), null).UIDescriptors; if (projection == null) { projection = x => x as IQueryable <TProjection>; } var context = getContext(); context.MergeOption = MergeOption.NoTracking; var source = new WcfInstantFeedbackDataSource { UseExtendedDataQuery = GetDbRepositoryQuery(getRepositoryFunc, projection).UseExtendedDataQuery, DataServiceContext = context }; var keyProperties = ExpressionHelper.GetKeyProperties(getRepositoryFunc(getUnitOfWork()).GetPrimaryKeyExpression); var keyExpression = keyProperties.Select(p => p.Name).Aggregate((l, r) => l + ";" + r); source.GetSource += (s, e) => { e.Query = GetDbRepositoryQuery(getRepositoryFunc, projection).Query; e.KeyExpression = keyExpression; e.Handled = true; }; return(new InstantFeedbackSource <TProjection>(source, threadSafeProperties)); }
public MainWindow() { Source = new WcfInstantFeedbackDataSource(); Source.GetSource += ((d, e) => { e.KeyExpression = "Oid"; e.Query = new SCEntities(new Uri(@"http://demos.devexpress.com/Services/WcfLinqSC/WcfSCService.svc")).SCIssuesDemo; e.Handled = true; }); DataContext = this; InitializeComponent(); }
public InstantFeedbackSource(WcfInstantFeedbackDataSource source, PropertyDescriptorCollection threadSafeProperties) { this.source = source; this.threadSafeProperties = threadSafeProperties; }