.net

Refactor select part of Linq expression?

I'm playing around with some Linq-SQL stuff, doing something like this: var foo = from f in db.Foo where f.Bar > 5 select f; which is all fine and dandy, and I know I can also do this: var foo = from f in db.Foo where f.Bar > 5 select new { f.Bar, f.Baz }; What I want to know, is can I factor out the select part of that query, if I...

WCF Cold Startup

I use WCF in a fairly demanding environment. One behavior that I have observed is something that I have taken to calling the cold startup. When I first startup a client that is calling a service there seem to be a lot of failures in the first calls. For instance I can watch the first say ten calls go through and then the next 200 calls f...

What is a partially trusted assembly/application/code/etc in .NET?

Could someone please explain? I couldn't find anything on the internet, everything talks about how to go about it in some way, but nothing says exactly what it is. Also, what is a fully trusted assembly and how do they differ from one another? I have a MS certification exam and this is the only topic that I just don't understand. EDI...

Does End Using close an open SQL Connection

If I wrap a SQLConnection in a Using, should I close it or does the end using handle it? using cn as new system.data.sqlclient.sqlconnection() cn.open '{do a bunch of other stuff with commands and datareaders here} cn.close 'Do I need this? end using ...

Creating a folder, writing a file to a shared folder on a server

Hi, My windows service is creating a directory on a shared folder, and I am getting a error: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path,DirectorySecurity dirSecurity) at System.IO.Directory.CreateDirectory(String path, DirectorySecur...

Using Assembly.GetType("MyCompany.Class1.Class2") returns null

I'm attempting to use Assembly.GetType("MyCompany.Class1.Class2") to dynamically get a type from a string. Assembly.GetType("MyCompany.Class1"); works as expected. If I embed a class within another class such as: namespace MyCompany { public class Class1 { //..... public class Class2 { //..... } } }...

Is there a way to debug an already running application compiled in release mode?

I have a dotnet windows service that's currently hung, but running. Is there anyway to attach a debugger to it, despite the lack of symbols; and that it's already running? ...

How do I hook the TAB key in a usercontrol so that focus doesn't move to a different control?

I have a usercontrol that is meant to take up the entire form. I want my usercontrol to handle the TAB key press and do something rather than have the TAB move focus to another control on the form. I'm handling the KeyDown event in my usercontrol, but it doesn't fire when the TAB key is pressed. ...

Forward declaration problem

I'm using C++ .NET 2.0 I have 2 forms the first one is declared as follow #include "stdafx.h" namespace myNamespace{ public ref class frmMain : public System::Windows::Forms::Form { /*... snip ...*/ public void addNewRow(String^ text){ /*... snip... */ } public void launchSubForm() { SubForm^ sf = gcnew S...

.net: Best solution for XmlSerializer and System.Drawing.Color

System.Drawing.Color objects apparently won't serialize with XmlSerializer. What is the best way to xml serialize colors? ...

Best way to databind a Winforms control to a nullable type?

I'm currently using winforms databinding to wire up a data editing form. I'm using the netTiers framework through CodeSmith to generate my data objects. For database fields that allow nulls it creates nullable types. I've found that using winforms databinding the controls won't bind properly to nullable types. I've seen solutions onl...

Is there a PDF version of the Castle Windsor documentation?

The only documentation I've found for the components of the Castle project I've found here in the form of online HTML files. Does anyone know of anything that is more off-line friendly or printable (e.g. PDF). I've got quite the long train commute and I'd like to put something on my laptop. :-) ...

Can an Ajax-enabled WCF Service pass back a DataTable as a Sys.Data.DataTable?

Can an Ajax-enabled WCF Service pass back a DataTable as a Sys.Data.DataTable? Like this but in WCF. My OperationContract looks like: [OperationContract] public DataTable GetEmployees() { NorthwindService ns = new NorthwindService(); return ns.GetEmployees(); } Through the Firefox error console I get t...

Updating the view count of a webpage in a database

I have a database table called "Posts" which stores all the information regarding an article submission on a website. There is a column named "Views" which is a value that gets incremented each time that particular post gets viewed. The process is this: Get the record from the database Increment the current by one Save the changes t...

Is there a best practice for accessing business logic services in a web app?

Is there a best practice for instantiating / calling business logic layer service in a web app? I've got a large number services that I keep instantiating and then disposing for just one method call. Should these be implemented as providers? Or maybe accessed from a singleton? Example code: void ShipProduct(){ ProductService serv...

MYSQL installation with a .NET winforms app

I have a C# application that's utilizes MYSQL. I'm at a beta release point and need an installation package that includes my application, along with MYSQL. So basically, I need to install MYSQL and perform a restore from within my .NET install package. Any help would be greatly appreciated. ...

Mono on the iPhone?

Has Mono been ported to the iPhone yet? I'd love to write .NET apps for the iPhone, and learning Objective C isn't an option for me. ...

What's the best way to use .NET classes from Visual Basic 6?

At my workplace I'm stuck with Visual Basic 6, but after reading the answer to "How do I sort arrays using vbscript?" I got my hopes up, that at least some of the missing VB6 features can be supplemented by .NET features. (Different kinds of collections, mostly) It seems, that at least some .NET classes are available for scripting and ...

Do I need a new .snk keyfile for each version of a strong named library?

If I strong name a class library with a .snk file, do I need to replace this .snk file with a new if I create a new version of the same library? ...

32 or 64 bit DLL loading from .Net managed code

I have a unmanaged DLL (the scilexer.dll of Scintilla code editor, used by Scintilla.Net from CodePlex) that is loaded from a managed application trough the Scintilla.Net component. The windows managed application runs without problem on both 32 and 64 bit environments, but I need to create different installations that uses the 64 or the...