How to mock ObjectContext or ObjectQuery<T> in Entity Framework?
How to mock ObjectContext or ObjectQuery in Entity Framework? ...
How to mock ObjectContext or ObjectQuery in Entity Framework? ...
Hi, What's the best way to keep a collection-object (List in example) in a Key/Value situation, where the key is a ID and the value is a collection of a type T? Is this the only option or is there a better solution/another collection for this in .NET 3.5? var x = new Dictionary<int, List<type>>(); ...
Hi, When I plug my laptop into my docking station, I want my external monitor to be the attached, and the primary monitor, positioned on the left hand side. To do this, I have to go into control panel, open display properties, position the monitors, attach, set to primary, then hit ok. Is there a way to do this in code??? I'd prefer ...
The following code will not run correctly in IE7 with the latest service packs installed. System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.Clear(); response.AddHeader("Content-Disposition", "attachment;filename=Contacts.xls"); response.ContentType = "application/octet-stream"; System.Text.UnicodeEnco...
Perhaps I'm missing something with the concept of Extension Methods, but I cannot gain access to the Extension Methods within the KeyCollection Class as defined here: http://msdn.microsoft.com/en-us/library/dk7e2d8e.aspx. Using the following code excerpt: Dictionary<int, int> foo = new Dictionary<int,int>(); foo.Add(1,1); Dict...
In Winforms you can say if ( DesignMode ) { // Do something that only happens on Design mode } is there something like this in WPF? ...
I have a C# application and I want to copy a file to a new location. Some times I need to overwrite an existing file. when this happens I receive a System.IO.IOException. I want to recover from a Sharing violation but how do I determine that IOException was returned because the destination file is in use rather then some other reason?...
I'm creating a custom control, part of which is using the Graphics class to draw text to the form. Currently I'm using the following code to display it: private float _lineHeight { get { return this.Font.Size + 5; } } private void Control_Paint(object sender, PaintEventArgs e) { Graphics g = this.CreateGraphics(); Brush b = new ...
My web application worked very well in a Windows Server 2003 with .NET Framework 2.0. When I migrated to Windows Server 2008 with .NET Framework 3.5. With the same code running in both servers the difference between them was the following: for a given async ASHX (IHttpAsyncHandler) the previous server automatically answered the request ...
After upgrading our web application to .NET 3.5 we noticed a strange issue with the Wizard control. Usually after IIS is restarted and a page with the control is loaded, the left hand navigation pane will not be displayed. Hitting this page again will solve this issue. It is also visible in dev environment, although it is intermittent an...
Hi, I am working on a project which was developed in Visual Studio 2005 (.NET 2.0). I have Visual Studio 2008 and on opening the solution the files are converted to older framework. But the project uses a AjaxControlKit which I guess is not available by default in ASP.NET 2.0 and hence it throws an error that a reference/library is mis...
I'm trying to build a very, very simple "micro-webapp" which I suspect will be of interest to a few Stack Overflow'rs if I ever get it done. I'm hosting it on my C# in Depth site, which is vanilla ASP.NET 3.5 (i.e. not MVC). The flow is very simple: If a user enters the app with a URL which doesn't specify all the parameters (or if an...
In WPF 3.5 (with SP1), I have simply StackPanel that I would like to animate when I change the property Visibility. I have no idea of the height of this StackPanel since its content determines its height. So when I change the property of my StackPanel to Visible (progressPanel.Visibility = Visibility.Visible;) I would like to see an anim...
I'm working on my first .NET project (.NET 3.5, ADO.NET and C#). We've built our entity models and are trying to build a clean business objects layer. We've got our basic entity model and we want to add certain business-level semantics to the default data accessors (navigation properties, etc). For example, let's assume that we have a...
I'd like to bind to a value reachable only with XPath from the property of an element. The element is a ComboBox populated from some XML, and its property is SelectedItem. SelectedItem points to an XML element, and I'd like to bind to a child element's value within that, which can be reached with an XPath. The XAML looks like this, so ...
We utilise a third party web service that returns XML which looks something like (cut down for brevity): <Response> <block name="availability"> <block name="cqual"> <a name="result-code" format="text">L</a> </block> <block name="exchange"> <a name="code" format="text">MRDEN</a> </block> <block name="mqu...
Hi folks, i need to read in a rolling log file in .NET 3.5sp1. I'm wondering what's the best way to do this? The file can get really big. An idea i had was to Open File Read file to last read line (in the first case, it was 0) Read all remaining lines Close stream and remember the last line number read. Wait a bit. Rinse/repeat. i'm...
how can i use asp.net dynamic data using EF in another dll and i dont want to put connection string in web.config or any config file. I have this code in Global.asax model.RegisterContext(() => new MyObjectContext("entityconnectionString"), new ContextConfiguration() { ScaffoldAllTables = true }); the defalut page is ok but when i cli...
I want to get started game programming in C/C++, or C# with DirectX or OpenGL. I'm not really sure what I want to get started, but a smallish project like a simple engine would be nice to get started with. Additionally, I would like to learn about designing applications in Windows with C#, .NET 3.5, and WPF. Utilizing C# and .NET, I inte...
This may be a silly question for some of you, but what are Pros/Cons of running a Windows Forms .Net application from a shared drive. Up until recently I didn't even know this was possible. From research it looks like .Net 3 SP1 allows this behavior (without requiring any security changes). I am curious as to any concurrency issues or ...