I've written an app that I use as an agent to query data from a database and automatically load it into my distributed web cache.
I do this by specifying an sql query and a type in a configuration. The code that actually does the querying looks like this:
List<Object> result = null;
try { result = dc.ExecuteQuery(elementType, entry.Com...
Hi. I feel the answer to this may lie with delegates, but I am having a hard time grasping the concept of delegates. The main problem is that every explanation and example of delegates I have ever read are always round about ways of doing something you could accomplish without delegates so to me it does not teach me anything. I learn bes...
I'm having a problem with this this XAML... When I run it, it hangs because of the TextBox. (By "hangs" I mean that the hosting aspx page shows in the browser, but the usercontrol object will not appear on the page, and there are some little green bars in the bottom of the Internet Explorer window that fill up but never go away.) I hav...
How can I set the DataContext on my Grid in XAML, instead of in the constructor?
Here is how I do it in the constructor (LayoutRoot is the XAML Grid defined in the XAML):
this.LayoutRoot.DataContext = this.HPVM;
I would prefer to do it right in the XAML, but I do not know how to reference the HPVM object in XAML. HPVM is a public pr...
In Silverlight XAML, I think I've just realized that a DataContext declaration on a nested container is relative to the parent container's DataContext. Can you all please confirm.
If so, then let me ask this: On a child XAML container element (i.e. StackPanel) how would you would jump out of that relative DataContext tree, and start at ...
I'm in a situation where I am being informed from an outside source that a particular entity has been altered outside my current datacontext. I'm able to find the entity and call refresh like so
MyDataContext.Refresh(RefreshMode.OverwriteCurrentValues, myEntity);
and the properties which have been altered on the entity are updated corr...
Is there any potential problem in setting datacontext as property like this:
repository
public Repository()
{
public DataContext dc {get;set;}
public GetOrders(int id)
{ ...from dc.Orders...}
}
service layer:
public GetNewOrders()
{
....
Repository rep=new Repository();
using {DataContext dc=...
I'm using Linq to SQL. I have a DataContext against which I am .SubmitChanges()'ing. There is an error inserting the identity field, and I'd like to see the query it's using to insert this identity field.
I don't see the query itself within the quickwatch; where can I find it from within the debugger?
...
I'm going through an XML file of articles and the journalist(s) that wrote them. As we are adding the articles into _Data our datacontext we may come across a journalist that needs adding so we do this:
newJourno = New journalist With {.name = strJournalist}
_Data.journalists.InsertOnSubmit(newJourno)
.articles_journalists.Add(New artic...
How do I tell a LINQ data context to ignore either specific properties, or all readonly properties, when binding a result set to an object?
I am working with some T-SQL statements that are difficult to express using LINQ, so I'm using the ExecuteQuery method of the data context to pass the straight T-SQL to the database.
If my class T ...
Hi All,
I'm currently using MVVM in a WPF project, all works very well.
I have one Master view and many Detail views that I manage using a currentView property in my MasterViewModel. By using a datatemplate, I bind a view to a viewmodel.
In fact, my master view has a contentcontrol whose content property is binded to my CurrentView prop...
Hi,
I have a problem with DataContextChanged not being raised on a logical child of my custom Panel control. I've narrowed it down to this:
Starting from a wizard-generated WPF application I add:
private void Window_Loaded( object sender, RoutedEventArgs e )
{
var elt = new FrameworkElement();
this.AddLogicalChild( elt );
D...
I have a DataContext (Linq to Sql) with over 100 tables, is it possible to get a list of all those tables and lets say print them to the console? This might be a silly question.
Thanks.
...
List item
I have defined a style in app.xaml. This style contains several text TextBlocks which I would like to controle as I apply the style to an object, in this case a UserPin.
How can I access these TextBlocks runtime?
I get the style by:
Style = Application.Current.Resources["UserPin"] as Style;
The style looks like this:
<Sty...
Original question: Does an Adorner automagically inherit the "DataContext" of its "AdornedElement" in WPF?
...
When showing my main window, I make a list of objects from linq-to-sql:
using (var context = new Data.TVShowDataContext())
{
Shows = new ObservableCollection<Data.Show>(context.Shows);
listShows.ItemsSource = Shows;
}
Now, when I doubleclick an item in my list, I want to use the selected object in a new usercontrol:
Sho...
What is the best way to run a custom sql statement using IN from a c# linq to sql datacontext? I have tried:
db.ExecuteCommand(
"UPDATE tblCard SET used = 1 WHERE id IN ({0}) AND customer_id = {1}",
Request.Form["ids"], customer_id
);
Which is fine for 1 item passed through the form, but if i get posted through for example "2,1"...
I have recently inheited a ASP.Net app using Linq2SQL. Currently It has its DataContext objects declared as static in every page, and i create them the first time i find they are null (singleton, sort of).
I need comments if this is good or bad. In situations when I only need to read from the DB and in situations where i need to write a...
Hi Geeks,
I've a stroe procedure to update a record and after running it I use LinqToSql to delete the record. I know it is weird but I just want to test how smart the datacontext it is and understand how it works.
Since the datacontext caches the results so any change via it can be recorded but now I use a store procedure to update so...
Does anyone know how to determine if the value of a WPF property is inherited? In particular, I'm trying to determine if the DataContext of a FrameworkElement was inherited from the parent or set directly on the element itself.
Thanks,
- Mike
...