public static GridDataModel GetData(DataContext db, string type, string columns, int page, int count, List<string> filter, string sort, string sortdir) { var ass = db.GetType().Assembly; //haha ass Type dbType = ass.GetType(type); var items = (IQueryable)db.GetType().GetMethod("GetTable").MakeGenericMethod(dbType).Invoke(db, null); return GetData(items, columns, page, count, filter, sort, sortdir); }
public static GridDataModel GetData(DataContext db, string type, string columns, int page, int count, List <string> filter, string sort, string sortdir) { var ass = db.GetType().Assembly; //haha ass Type dbType = ass.GetType(type); var items = (IQueryable)db.GetType().GetMethod("GetTable").MakeGenericMethod(dbType).Invoke(db, null); return(GetData(items, columns, page, count, filter, sort, sortdir)); }
private void btnExploreNotes_Click(object sender, RoutedEventArgs e) { var func = CustomFilter.TryGetValue(DataContext.GetType()); var eo = new ExploreOptions(typeof(NoteEntity)) { ShowFilters = false, SearchOnLoad = true, FilterOptions = { func != null ? func((Entity)DataContext) : new FilterOption("Target", DataContext) { Frozen = true }, }, OrderOptions = { new OrderOption("CreationDate", OrderType.Ascending) }, Closed = (_, __) => Dispatcher.Invoke(() => ReloadNotes()) }; if (func == null) { eo.ColumnOptions = new List <ColumnOption> { new ColumnOption("Target") }; eo.ColumnOptionsMode = ColumnOptionsMode.Remove; } Finder.Explore(eo); }
private void Grid_SizeChanged(object sender, SizeChangedEventArgs e) { if (DataContext != null && DataContext.GetType() == typeof(ViewModel.EditProjectVM)) { ((ViewModel.EditProjectVM)DataContext).DisplaySettingsTool.SizeChanged(e.NewSize.Width, e.NewSize.Height); } }
protected override void OnInit(IDotvvmRequestContext context) { var controlBuilderFactory = context.Configuration.ServiceLocator.GetService <IControlBuilderFactory>(); DotvvmControl control; if (DataContext.GetType() == typeof(InfoStep)) { var builder = controlBuilderFactory.GetControlBuilder("Controls/InfoStep.dotcontrol"); control = builder.BuildControl(controlBuilderFactory); } else if (DataContext.GetType() == typeof(ChoicesStep)) { var builder = controlBuilderFactory.GetControlBuilder("Controls/ChoicesStep.dotcontrol"); control = builder.BuildControl(controlBuilderFactory); } else if (DataContext.GetType() == typeof(CodeStepDotHtml)) { var builder = controlBuilderFactory.GetControlBuilder("Controls/DothtmlStep.dotcontrol"); control = builder.BuildControl(controlBuilderFactory); } else if (DataContext.GetType() == typeof(CodeStepCsharp)) { var builder = controlBuilderFactory.GetControlBuilder("Controls/CodeStep.dotcontrol"); control = builder.BuildControl(controlBuilderFactory); } else { throw new NotSupportedException(); } Children.Add(control); base.OnInit(context); }
public ALinqDataModelProvider(object contextInstance, Func <object> contextFactory) { this.ContextFactory = contextFactory; DataContext context = ((DataContext)contextInstance) ?? ((DataContext)this.CreateContext()); this.ContextType = context.GetType(); Dictionary <Type, PropertyInfo> dictionary = new Dictionary <Type, PropertyInfo>(); foreach (PropertyInfo info in this.ContextType.GetProperties()) { if (info.PropertyType.IsGenericType && (info.PropertyType.GetGenericTypeDefinition() == typeof(Table <>))) { Type type2 = info.PropertyType.GetGenericArguments()[0]; dictionary[type2] = info; } } List <TableProvider> source = new List <TableProvider>(); foreach (MetaTable table in context.Mapping.GetTables()) { PropertyInfo contextProperty = dictionary[table.RowType.Type]; source.Add(new ALinqTableProvider(this, table, contextProperty)); } this.DLinqTables = new List <ALinqTableProvider>(source.Cast <ALinqTableProvider>()); foreach (TableProvider provider in source) { ((ALinqTableProvider)provider).Initialize(); } this._roEntities = new ReadOnlyCollection <TableProvider>(source); }
private void Ok_Click(object sender, RoutedEventArgs e) { if (this.DataContext is Entity && SaveProtected) { if (!this.HasChanges()) { DialogResult = true; } else { var result = MessageBox.Show( NormalWindowMessage.ThereAreChangesContinue.NiceToString(), NormalWindowMessage.ThereAreChanges.NiceToString(), MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.OK); if (result == MessageBoxResult.Cancel) { return; } DialogResult = false; } } else { string errors = this.GetErrors(); if (errors.HasText()) { Type type = DataContext.GetType(); switch (AllowErrors) { case AllowErrors.Yes: break; case AllowErrors.No: MessageBox.Show(this, NormalWindowMessage.The0HasErrors1.NiceToString().ForGenderAndNumber(type.GetGender()).FormatWith(type.NiceName(), errors.Indent(3)), NormalWindowMessage.FixErrors.NiceToString(), MessageBoxButton.OK, MessageBoxImage.Exclamation); return; case AllowErrors.Ask: if (MessageBox.Show(this, NormalWindowMessage.The0HasErrors1.NiceToString().ForGenderAndNumber(type.GetGender()).FormatWith(type.NiceName(), errors.Indent(3)) + "\r\n" + NormalWindowMessage.ContinueAnyway.NiceToString(), NormalWindowMessage.ContinueWithErrors.NiceToString(), MessageBoxButton.YesNo, MessageBoxImage.Exclamation, MessageBoxResult.None) == MessageBoxResult.No) { return; } break; } } base.DialogResult = true; } }
private void FooterDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { _generatedButtons.ForEach(button => ButtonsPanel.Children.Remove(button)); _generatedButtons.Clear(); if (DataContext is null) { return; } DataContext .GetType() .GetMethods() .Select(methodInfo => new { Attribute = methodInfo.GetCustomAttribute <GenerateButtonAttribute>(), MethodInfo = methodInfo }) .Where(x => x.Attribute != null) .OrderBy(x => x.Attribute.Order) .ToList() .ForEach(x => { var button = new LabeledButton(); button.SetBinding(ButtonBase.CommandProperty, new Binding(string.IsNullOrWhiteSpace(x.Attribute.BindCommandTo) ? $"{x.MethodInfo.Name}Command" : x.Attribute.BindCommandTo)); button.SetBinding(LabeledButton.LabelProperty, new Binding(string.IsNullOrWhiteSpace(x.Attribute.BindTextTo) ? $"{x.MethodInfo.Name}Label" : x.Attribute.BindTextTo)); ButtonsPanel.Children.Add(button); _generatedButtons.Add(button); }); }
/// <summary> /// Set the size of the item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SetSize(object sender, RoutedEventArgs e) { var sizeProp = DataContext.GetType().GetProperty("Size"); if (sizeProp == null) { return; } if (sender is Button) { switch (((Button)sender).Content) { case "Small": sizeProp.SetValue(DataContext, CowboyCafe.Data.Size.Small); break; case "Medium": sizeProp.SetValue(DataContext, CowboyCafe.Data.Size.Medium); break; case "Large": sizeProp.SetValue(DataContext, CowboyCafe.Data.Size.Large); break; } } }
/// <summary> /// Set the type of soda /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SetSoda(object sender, RoutedEventArgs e) { var sodaProp = DataContext.GetType().GetProperty("Flavor"); if (sodaProp == null) { return; } if (sender is Button) { switch (((Button)sender).Content) { case "Cream Soda": sodaProp.SetValue(DataContext, SodaFlavor.CreamSoda); break; case "Orange Soda": sodaProp.SetValue(DataContext, SodaFlavor.OrangeSoda); break; case "Sarsparilla": sodaProp.SetValue(DataContext, SodaFlavor.Sarsparilla); break; case "Birch Beer": sodaProp.SetValue(DataContext, SodaFlavor.BirchBeer); break; case "Root Beer": sodaProp.SetValue(DataContext, SodaFlavor.RootBeer); break; } } }
/// <summary> /// Updates the binding. /// </summary> private void UpdateBinding() { if (_element != null && _element.DataContext != null && ElementPath != null && DataContextPath != null) { var dataContext = _element.DataContext as DependencyObject; if (dataContext != null) { var elementPropInfo = _element.GetType().GetProperty(ElementPath + "Property", BindingFlags.Static | BindingFlags.Public); var dataContextPropInfo = DataContext.GetType().GetField(DataContextPath + "Property", BindingFlags.Static | BindingFlags.Public); if (elementPropInfo != null && dataContextPropInfo != null) { _element_dp = elementPropInfo.GetValue(_element) as DependencyProperty; _datacontext_dp = dataContextPropInfo.GetValue(dataContext) as DependencyProperty; if (_element_dp != null && _datacontext_dp != null) { if (_callback_token != 0) { dataContext.UnregisterPropertyChangedCallback(_datacontext_dp, _callback_token); } _callback_token = dataContext.RegisterPropertyChangedCallback(_datacontext_dp, OnDataContextPropertyChanged); } } } } }
private void MainWindow_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (DataContext != null && DataContext.GetType() == typeof(MainWindowVM)) { ((MainWindowVM)DataContext).ViewResources = Resources; } }
public override void OnShowing() { if (DataContext == null) { return; } var currentRow = 0; foreach (var property in DataContext.GetType().GetProperties()) { var element = CreateElement(property); if (element != null) { grid.RowDefinitions.Add(new RowDefinition()); var text = new TextBlock() { Text = property.Name }; text.SetValue(Grid.RowProperty, currentRow); text.SetValue(Grid.ColumnProperty, 0); grid.Children.Add(text); element.SetValue(Grid.RowProperty, currentRow); element.SetValue(Grid.ColumnProperty, 1); grid.Children.Add(element); currentRow++; } } }
/// <summary> /// Gets an instance of a DataContext. /// </summary> /// <returns></returns> internal DataContext GetDataContext() { string threadDataKey = "SqlDataContext" + _providerName; var threadData = ThreadDataManager.GetCurrentNotNull(); if (threadData.HasValue(threadDataKey)) { DataContext result = Verify.ResultNotNull(threadData[threadDataKey] as DataContext); // In a result of a flush, data context type can be changed if (result.GetType().GUID == DataContextClass.GUID) { return(result); } } DataContext dataContext = CreateDataContext(); dataContext.ObjectTrackingEnabled = false; threadData.OnDispose += dataContext.Dispose; threadData.SetValue(threadDataKey, dataContext); if (_sqlLoggingContext.Enabled) { dataContext.Log = new SqlLoggerTextWriter(_sqlLoggingContext); } return(dataContext); }
private Program() { using (DataContext dc = DataContextFactory.GetInstance()) { LoggerBundle.Debug("Trying to load data of every model type..."); foreach (Type t in Types) { LoggerBundle.Trace($"Loading data for set of type '{t.Name}'..."); MethodInfo setMethod = dc.GetType().GetMethods().First(x => x.Name.Equals("Set")); MethodInfo setMethodGeneric = setMethod.MakeGenericMethod(t); Object set = setMethodGeneric.Invoke(dc, new Object[] { }); MethodInfo methodLoad = typeof(EntityFrameworkQueryableExtensions).GetMethods() .First(x => x.Name.Equals("Load")); MethodInfo methodLoadGeneric = methodLoad.MakeGenericMethod(t); methodLoadGeneric.Invoke(set , new[] { set }); dc.SetTracks.Load(); LoggerBundle.Trace("Loading data done."); } LoggerBundle.Debug("Done."); } }
private static String GetIsolationLevel(DataContext dataContext) { var appSettingsKey = String.Format("{0}.AutoTransaction", dataContext.GetType().Name); var autoTransaction = ConfigurationManager.AppSettings[appSettingsKey]; IsolationLevel isolationLevel; if (Enum.TryParse(autoTransaction, true, out isolationLevel)) { switch (isolationLevel) { case IsolationLevel.ReadCommitted: return("READ COMMITTED"); case IsolationLevel.ReadUncommitted: return("READ UNCOMMITTED"); case IsolationLevel.RepeatableRead: return("REPEATABLE READ"); case IsolationLevel.Serializable: return("SNAPSHOT"); case IsolationLevel.Snapshot: return("SERIALIZABLE"); } } return(null); }
private void BuildDetailsPanel(Grid panel) { if (panel == null) { return; } //clearing panel items panel.Children.Clear(); //clearing panel row definitions panel.RowDefinitions.Clear(); //changed stackpanel to Grid foreach (PropertyInfo propertyInfo in DataContext.GetType().GetPropertiesForUserInterface()) { //add label panel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(0, GridUnitType.Auto) }); var label = propertyInfo.GetLabel(); Grid.SetRow(label, panel.RowDefinitions.Count - 1); panel.Children.Add(label); panel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(0, GridUnitType.Auto) }); var control = propertyInfo.GetControl(DataContext); Grid.SetRow(control, panel.RowDefinitions.Count - 1); panel.Children.Add(control); } //BuildDynamicXamlContextMenu(panel); }
private void ViewChanged() { if (!(FindName("ProjectMenu") is MenuItem projectMenu)) { return; } var isSavable = DataContext.GetType().GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(ISavable <>)); projectMenu.Visibility = Visibility.Collapsed; projectMenu.Items.Clear(); if (isSavable) { projectMenu.Visibility = Visibility.Visible; projectMenu.Items.Add(GetSaveProjectMenuItem()); projectMenu.Items.Add(GetLoadProjectMenuItem()); projectMenu.Items.Add(GetNewProjectMenuItem()); } if (DataContext is IHaveExtraProjectMenuItems havingExtraProjectMenuItems) { projectMenu.Visibility = Visibility.Visible; foreach (var menuItem in havingExtraProjectMenuItems.GetMenuItems()) { projectMenu.Items.Add(menuItem); } } }
public static T SingleOrDefault <T>(this DataContext context, Func <T, bool> whereClause = null) where T : class, IEntity { SqlConnection connection = new SqlConnection(context.Connection.ConnectionString); DataContext newContext = (DataContext)Activator.CreateInstance(context.GetType(), new object[] { connection }); List <T> data = null; T ret = null; try { if (whereClause == null) { data = newContext.GetTable <T>().ToList(); } else { data = newContext.GetTable <T>().Where(whereClause).ToList(); } if (data.Count == 1) { ret = data[0]; } else if (data.Count > 0) { throw new ApplicationException("More than one row was returned querying SingleOrDefault for " + typeof(T).Name); } } catch (Exception ex) { LogException(ex); throw; } return(ret); }
private void EnsureTableInitialized(string tableName) { if (_tables.ContainsKey(tableName)) { return; } lock (_syncRoot) { if (_tables.ContainsKey(tableName)) { return; } Type dataContextType = _dataContext.GetType(); FieldInfo fi = dataContextType.GetField(tableName); Verify.IsNotNull(fi, "DataContext class should have a field with name '{0}'", tableName); Type entityType = fi.FieldType; // Operation takes 3 ms every request :( ITable table = _dataContext.GetTable(entityType); _tables.Add(tableName, table); } }
void WizardMappingPage_Loaded(object sender, RoutedEventArgs e) { if (DataContext.GetType() != typeof(MappingPageViewModel)) { DataContext = ((WizardViewModel)this.DataContext).MappingPageViewModel; } }
/* * /// <summary> * /// Clone the entity so we it loses its association with any existing data context. * /// </summary> * public static T CloneEntity<T>(this T originalEntity) * { * Type entityType = typeof(T); * DataContractSerializer ser = new DataContractSerializer(entityType); * * using (MemoryStream ms = new MemoryStream()) * { * ser.WriteObject(ms, originalEntity); * ms.Position = 0; * return (T)ser.ReadObject(ms); * } * } * * public static T CloneEntityOfConcreteType<T>(this T originalEntity) * { * Type entityType = typeof(T); * DataContractSerializer ser = new DataContractSerializer(entityType, new Type[] { originalEntity.GetType() }); * * using (MemoryStream ms = new MemoryStream()) * { * ser.WriteObject(ms, originalEntity); * ms.Position = 0; * return (T)ser.ReadObject(ms); * } * } */ public static List <T> Query <T>(this DataContext context, Func <T, bool> whereClause = null) where T : class, IEntity { SqlConnection connection = new SqlConnection(context.Connection.ConnectionString); DataContext newContext = (DataContext)Activator.CreateInstance(context.GetType(), new object[] { connection }); List <T> data = null; try { if (whereClause == null) { data = newContext.GetTable <T>().ToList(); } else { data = newContext.GetTable <T>().Where(whereClause).ToList(); } } catch (Exception ex) { LogException(ex); throw; } return(data); }
private void LoadProperties() { Type type = DataContext.GetType(); PropertyInfo[] infos = type.GetProperties(BindingFlags.Instance | BindingFlags.Public); foreach (PropertyInfo info in infos) { if (!(info.GetCustomAttribute <VisibleInViewAttribute>()?.VisibleInList ?? true)) { continue; } mainGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); DetailFrameItemBase item = itemContainer.Create(info, DataContext); Control captionControl = item.CaptionControl; Control editorControl = item.EditorControl; Grid.SetRow(captionControl, mainGrid.RowDefinitions.Count - 1); mainGrid.Children.Add(captionControl); editorControl.Margin = new Thickness(5); Grid.SetColumn(editorControl, 1); Grid.SetRow(editorControl, mainGrid.RowDefinitions.Count - 1); mainGrid.Children.Add(editorControl); } }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.LeftButton != MouseButtonState.Pressed) { dragStartPoint = null; } if (!dragStartPoint.HasValue) { return; } var dataObject = new DragObject { DataContextType = DataContext?.GetType() }; if (VisualTreeHelper.GetParent(this) is WrapPanel panel) { var scale = 1.5; dataObject.DesiredSize = new Size(panel.ItemWidth * scale, panel.ItemHeight * scale); } DragDrop.DoDragDrop(this, dataObject, DragDropEffects.Copy); e.Handled = true; }
private CustomLookUpOptPopupContent CreateWindow() { var destType = typeof(IListViewModel <>).MakeGenericType(_itemType); var model = (IObjectListViewModel)IoC.Instance.Resolve(destType, null); model.Mode = ObjectListMode.LookUpList3Points; model.ParentViewModelSource = ParentViewModelSource; model.AllowAddNew = true; model.InitializeMenus(); var modelCapt = model as PanelViewModelBase; if (modelCapt != null) { modelCapt.SetPanelCaptionPrefix(DataContext.GetType()); modelCapt.IsActive = true; } var result = new CustomLookUpOptPopupContent { DataContext = model }; if (result.Owner == null && Application.Current.MainWindow.IsActive) { result.Owner = Application.Current.MainWindow; } return(result); }
bool TryToInvokeDefaultProperty(Assignment context) { var attributeName = context.Name; var attributeValue = context.Value; var property = View.GetType().GetProperty(attributeName); if (property == null) { var eventInfo = View.GetType().GetEvent(attributeName); if (eventInfo == null) { throw Errors.PropertyNotFound(attributeName, View.GetType()); } var handlerMethod = DataContext.GetType().GetMethod(attributeValue.ToString()); if (handlerMethod == null) { throw Errors.MethodNotFound(attributeValue.ToString(), DataContext.GetType()); } eventInfo.AddEventHandler(View, handlerMethod.CreateDelegate(eventInfo.EventHandlerType, DataContext)); return(true); } var converter = TypeDescriptor.GetConverter(property.PropertyType); if (converter.CanConvertFrom(attributeValue.GetType())) { attributeValue = converter.ConvertFrom(attributeValue); } property.SetValue(View, attributeValue); return(true); }
private void BuildContextActionPanel(Panel panel) { if (panel == null) { return; } panel.Children.Clear(); bool haveMenuItem = false; foreach (MethodInfo method in DataContext.GetType().GetMethodsForUserInterfaceAction()) { panel.Children.Add(method.GetControl(DataContext)); haveMenuItem = true; } if (!haveMenuItem) { var label = new Label(); label.SetValue(ContentControl.ContentProperty, "No Menu available..."); panel.Children.Add(label); } }
public static bool Exists <T>(this DataContext context, Func <T, bool> whereClause = null) where T : class, IEntity { SqlConnection connection = new SqlConnection(context.Connection.ConnectionString); DataContext newContext = (DataContext)Activator.CreateInstance(context.GetType(), new object[] { connection }); int count = 0; try { if (whereClause == null) { count = newContext.GetTable <T>().Count(); } else { count = newContext.GetTable <T>().Where(whereClause).Count(); } } catch (Exception ex) { LogException(ex); throw; } return(count > 0); }
protected override CustomLookUpOptPopupContent CreateWindow() { var model = (IObjectListViewModel) new PartnerWithAddressListViewModel(); model.Mode = ObjectListMode.LookUpList3Points; model.AllowAddNew = true; model.InitializeMenus(); ((PanelViewModelBase)model).SetPanelCaptionPrefix(DataContext.GetType()); ((PanelViewModelBase)model).IsActive = true; if (EditValue != null) { model.ValueMember = GetValueMember(); model.EditValue = EditValue; } // выставляем ограничения на кол-во строк if (model.CustomFilters != null) { model.CustomFilters.MaxRowCount = MaxFetchItemsCount; model.CustomFilters.FilterExpression = "NONE"; model.CustomFilters.SqlFilterExpression = FilterInternal; if (!string.IsNullOrEmpty(FilterInternal)) //Внимание. Метод зависит от наличия меню - model.InitializeMenus { model.ChangeImageFilter(false); } } // если у нас уже нафильтровано какое-то кол-во значений - отдаем их в форму if (ItemsSource != null) { var items = new ObservableRangeCollection <Partner>(); foreach (var item in ((IList)ItemsSource).OfType <Partner>()) { var obj = (Partner)item.Clone(); obj.Address = item.Address; obj.AcceptChanges(); items.Add(obj); } model.SetSource(items); } else // иначе лезем в БД за данными для "..." { model.ApplyFilter(); } var result = new CustomLookUpOptPopupContent { DataContext = model, }; if (result.Owner == null && Application.Current.MainWindow.IsActive) { result.Owner = Application.Current.MainWindow; } return(result); }
private static DbCommandOptimizer GetDbCommandOptimizer(DataContext dataContext) { var contextTypeName = dataContext.GetType().Name; var dbOptimizer = CommonObjectCache.InitObjectCache(contextTypeName, () => CreateDbOptimizer(dataContext)); return(dbOptimizer); }
public override object ProvideValue(IServiceProvider serviceProvider) { if (DataContext == null) { return("{Null}"); } return("{" + DataContext.GetType().Name + "}"); }
public virtual object CreateTable(Type rowType, DataContext context) { object table = null; var pluralInflections = MapPluralInflections(); var pluralizedName = rowType.Name + "s"; if (pluralInflections.ContainsKey(rowType.Name)) { pluralizedName = pluralInflections[rowType.Name].ToString(); } var property = context.GetType().GetProperty(pluralizedName); if (property == null) { throw new MissingMemberException(context.GetType().FullName, pluralizedName); } table = property.GetValue(context, null); return table; }
/// <exclude /> internal static ITable GetTable(DataContext _dataContext, SqlDataTypeStoreTable storeInformation) { FieldInfo fi = storeInformation.DataContextQueryableFieldInfo; Verify.IsNotNull(fi, "Missing FieldInfo for a DataContext field."); object value = fi.GetValue(_dataContext); if(value == null) { var helperClassFieldInfo =_dataContext.GetType().GetField("_sqlDataContextHelperClass", BindingFlags.NonPublic | BindingFlags.Instance); Verify.IsNotNull(helperClassFieldInfo, "Helper field isn't exist in DataContext object."); var helper = helperClassFieldInfo.GetValue(_dataContext) as SqlDataContextHelperClass; Verify.That(helper != null, "Helper object has not been set"); helper.EnsureTableInitialized(fi.Name); value = helper._tables[fi.Name]; } return Verify.ResultNotNull(value as ITable); }
private static object GetProvider(DataContext dataContext) { Type contextType = dataContext.GetType(); PropertyInfo providerProperty = contextType.GetProperty("Provider", BindingFlags.Instance | BindingFlags.NonPublic); if (providerProperty == null) return null; return providerProperty.GetValue(dataContext, null); }
public override IQueryable ResourceContainerToQueryable(ResourceContainer container) { //Get Lts Type Type type = this._resourceTypeToWorkspaceTypeList[container.BaseType]; DataContext context = new DataContext(this.Database.DatabaseConnectionString); MethodInfo method = context.GetType().GetMethod("GetTable", new Type[] { }); MethodInfo genMethod = method.MakeGenericMethod(new Type[] { type }); object o = genMethod.Invoke(context, new object[] { }); if (container.HasInterceptorExpression) { o = ApplyQueryInterceptorExpression(container, o as IQueryable); } return (IQueryable)o; }