.net

Entity framework and queries' SQL logging

I'm using LINQ to Entities. I need to log the resulting SQL of every executed query. It'd be nice to log the execution times and the number of rows returned, though it's not crucial. Is there a way to do this from within the app? I'd rather not use the SQL Profiler. There should be a way to trace everything that goes from the framework...

Load and save bitmaps using dotnet

This may be simple one, but 5 mins of Googling didn't give me the answer. How do you save and load bitmaps using .Net librabries? I have an Image object and I need to save it to disk in some format (preferably png) and load back in later. A C# example would be great. ...

Why does RSACryptoServiceProvider.VerifyHash need an LDAP check?

I recently encountered an odd problem with RSACryptoServiceProvider.VerifyHash. I have a web application using it for decryption. When users running the web service were doing so over our VPN it became very very slow. When they had no connection or a internet connection they were fine. After much digging I found that every time RSACry...

Using VS 2005 to design abstract forms

There's a famous bug in Visual Studio that prevents you from using the form designer on a subclass of an abstract form. This problem has already been elucidated and solved most elegantly by Urban Potato; that's not the part I'm having trouble with. The trouble is, I have duplicated the technique described by Urban Potato, and include...

.Net WebBrowser.DocumentText Isn't Changing!

In my vb.net program, I am using a webbrowser to show the user an HTML preview. I was previously hitting a server to grab the HTML, then returning on an asynchronous thread and raising an event to populate the WebBrowser.DocumentText with the HTML string I was returning. Now I set it up to grab all of the information on the client, wit...

How do you copy a MS SQL 2000 database programmatically using C#?

I need to copy several tables from one DB to another in SQL Server 2000, using C# (VS 2005). The call needs to be parameterized - I need to be able to pass in the name of the database to which I am going to be copying these tables. I could use DTS with parameters, but I can't find any sample code that does this from C#. Alternatively,...

Best open source LINQ provider

What's the best open source LINQ provider (in terms of completeness)? I'm developing an open source LINQ provider myself and I'd like to borrow as many ideas as I can, avoid common pitfalls, etc. Do not restrict yourself to database LINQ providers, any provider suggestion is welcome. ...

customized pages in TFS 2008

Can we extend the Team Site to host our own pages. i.e. Does TFS allows you to add pages/web parts that are developed by us. I have found few clues in Google but no one could elaborate properly. ...

How to turn off warning for no xml comment in VS 2005

At some point in time I turned on a setting in Visual Studio 2005 that produces a warning when methods/classes don't have an xml comment associated with them. I would like to turn this off, but can't seem to find the setting again. Anyone know where this is? ...

Disable the scroll bar in MDI Parent

It is possible to prevent scroll bars from appearing when you drag a Mdichild outside the bounds of the Mdiparent in vb.net? I would prefer the solution to not involve checking the posistion of the child form as there are too many forms to alter. Obviously autoscroll is set to false on the mdiparent and setting VScroll and HScroll to f...

Saving - Order of operations in .NET (C#)

I have a btnSave_Click() function in my code-behind. If a user clicks the save button (image) I created, it calls this function: protected void btnSave_Click(object sender, EventArgs e) { this.saveForm(); txtMessages.Text = "Save Complete"; } The saveForm() function obviously saves the form (through stored procedures). Will .NET wait ...

Sorting a list into multiple vertical columns

Does anyone have a good algorithm for re-sorting an array of values (already pre-sorted) so that they can be displayed in multiple (N) columns and be read vertically? This would be implemented in .Net but I'd prefer something portable and not some magic function. A good example of it working is the ASP.Net CheckBoxList control rendering...

What are best practices for using thread local storage in .NET?

I have a requirement in my application that I think can be met by using thread local storage, but I'm wondering if it's one of those things that's best to avoid. I have read a few articles on the subject: http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=58 http://msdn.microsoft.com/en-us/library/system.threadstaticatt...

ASP.Net compiliation

I have a question about asp.net compiling. I know the different ways you can compile but my question is with the default method. Microsoft says that pages and code are compiled on their first use and then cached. My question is, when does that cache clear... when the app pool recycles? Or, does it cache it until it's changed even thr...

What is the best way to use assembly versioning attributes?

The AssemblyVersion and AssemblyFileVersion attributes are the built-in way of handling version numbers for .NET assemblies. While the framework provides the ability to have the least significant parts of a version number (build and revision, in Microsoft terms) automatically determined, I find the method for this pretty weak, and no dou...

How to edit CSS style of a div using C# in .NET

I'm trying to grab a div's ID in the code behind (C#) and set some css on it. Can I grab it from the DOM or do I have to use some kind of control? <div id="formSpinner"> <img src="images/spinner.gif" /> <p>Saving...</p> </div> ...

What's the difference between AppDomain.CurrentDomain.BaseDirectory and Application.ExecutablePath in practice?

According to the MSDN, the BaseDirectory is where an AppDomain will look for DLLs to load, while ExecutablePath will provide the path to the original executable file (including file name). I know that one has the file name and the other does not. I know that if I create a new AppDomain I can give it a different path. But removing the ...

Loops and Garbage Collection

I am working on a web application and I have run into the following situation. Dim a as Object Dim i as Integer = 0 Try For i=1 to 5 a = new Object() 'Do stuff ' a = Nothing Next Catch Finally a = Nothing End Try Do i need to do the a=Nothing in the loop or will the garbage collector clean ...

How can I call SSIS programmatically from .NET?

I have an application where whenever a file is uploaded to a directory, I have to call SSIS to parse the XML file. Can I call a SSIS directly from a .NET Windows service? ...

One entity shared across two web services?

I'm working on a project where I have 2 web services that need the same entity. The 2 web services are on the same server so on the back-end, they share the same classes. On the front-end side, my code consumes both web services and sees the entities from both services as separate (in different namespaces) so I can't use the entity acr...