.net

StructureMap -> EnrichWith is enriching too much (other instances)

// Enrich with is enriching more than i want public intefrace ICommand { void Execute(); } // classes public class A : ICommand {} public class B : ICommand {} public class MultiCommand : ICommand { public MultiCommand(ICommand[] commands) {} } // -- decorators public DecoratorOne : ICommand { public DecoratorOne(Icommand toDe...

VB.NET inserting xml nodes into an existing XML document

I'm simply trying to merge 2 xml documents (adding nodes from one into the other). I've done some Google searching, and tried a few things, but I always get the same error "The node to be inserted is from a different document context" I'm sure I'm missing something simple, just seems like this should not be that difficult. Here's my c...

How to set the StreamingContext for DataContractSerializer?

I have some code something like this: [DataContract] class Foo { [OnSerializing] private void BeforeSerialize(StreamingContext ctx) { ((MtType)ctx.Context).DoStuff() } ... } var reader = new XmlTextReader(filename); var serializer = new DataContractSerializer(typeof(Type)); Type type = (Type)serializer.Read...

C#: How to access a button outside the form class

Hello, I want to either enable or disable a button from another file,what should I do? This is the form class declaration: public partial class Form1 : Form I tried with Form.btnName.enabled = false/true but there's no btnName member. Thanks in advance! ...

How to receive event when network is connected and also when user logs in

I have a service that runs and I'd like to receive notification when: a) the network is connected. b) when a user logs in to the machine. How can I do this? (C# .NET 2.0) ...

Retain foreground window when starting drag and drop operation

In my .Net application, the user can drag rows from a grid on a main window into other application windows. Often the main application window is behind the window that the user is dragging into. By default, as soon as the mouse button is depressed on the main window, it gains focus, hiding the window that the user wants to drag onto. I...

ASP.NET Writing PDF to filesystem

I have a report that I currently allow the user to choose an output option (HTML or PDF) when they are supplying the report parameters (date range, filters, etc.). I want to change the report such that it always does HTML and puts a link on the rendered HTML page so the user can grab the PDF if they want it. How do I modify my IIS6/IIS...

Why isn't my IE MIME filter being created or called?

I'm trying to create a MIME filter to do some custom processing of resources received with web pages before passing them to the web browser control in our Windows application. The application is written in C#, and I'd like to write the MIME filter in managed code as well, if possible. I'm having trouble with it though: my filter object...

Accessing Sabre Web Services using PHP

I have been approached to create a website using Sabre Web Services to power the reservations system. All documentation I have seen refers to .NET or Java solutions, I was in doubt whether PHP can be used as access is performed using SOAP. I have found no further information about this, I assume the answer is yes, but wonder why there is...

How would you get an array of Unicode code points a .NET String?

BACKSTORY: I have a list of character range restrictions that I need to check a string against, but the char type in .NET is UTF-16 and therefore some characters become wacky (surrogate) pairs instead. Thus when enumerating all the char's in a string, I don't get the 32-bit Unicode code points and some comparisons with high values fail....

How do I create a generic class from a string in C#?

Hello ... I have a Generic class like that : public class Repository<T> {...} And I need to instance that with a string ... Example : string _sample = "TypeRepository"; var _rep = new Repository<sample>(); How can I do that? Is that even possible? Thanks! ...

Diagnosing SqlConnection leaks?

Hi all, I'm running into an issue with a web application that is exhausting all available connections in the connection pool. I seem to recall some good tools used to diagnose all active connections, but am drawing a blank. What are some good options for diagnosing this issue? ...

database connection doesn't work when service starts at boot but works when it's manually started

I'm trying to track down possible causes of my app not being able to connect to a db server. I have a windows service that connects to the database when it starts. The service runs on machines with a reliable wired network connection. It's installed with startup Automatic so normally it starts when windows does, and in almost all cases...

Windows Service Application Controller

Here is the premise: I have a desktop that I need to be able to start up and stop applications on, but cannot get remote access to. What I had in mind is setting up a service on the machine that will start/stop a list of applications as told. This windows service will periodically pole a web service for new commands and execute them acc...

The purpose of delegates

Duplicate: Difference between events and delegates and its respective applications What are the advantages of delegates? Where do I use delegates? I wonder what the purpose of delegates is. I haven't used them that much and can't really think of something. In my courses, it's written that a delegate is a blue-print for a...

How Can I Debug a Specific Rowtest?

How can I debug a specific rowtest? I'm using Visual Studio and nUnit. TDD.NET addon is great but it doesn't let me to debug a specific rowtest, before coming to my test I have to go through all previous tests. I know there are some commercial solutions for this. I'm looking for a free (or really cheap) solution. <RowTest()> _ ...

Which ORM is the best when using Stored Procedures

So, I asked before what a good ORM was and the answer seemed to be nhibernate. I went through the giant learning curve and well it’s awesome, but totally won’t work for me. I sadly must use stored procedures and its ability to use them is very limited. So I have Business objects (DEVELOPERS WRITE) and some SPROCS (DBA WRITE)…… I know wh...

Deploying application updates to multiple sites

I have an application consisting of an ASP.NET web application, a couple of Windows services, and a SQL Server 2005 database. This application is replicated at several sites, so that each site has a server containing all parts (web app, services, & DB). Currently the process for deploying updates is this: Database Script database ch...

Is passive logging possible in .NET?

I'm frequently frustrated by the amount of logging I have to include in my code and it leads me to wonder if there's a better way of doing things. I don't know if this has been done or if someone has come up with a better idea but I was wondering is there a way anyone knows of to "inject" a logger into an application such that it passiv...

NHibernate proxies prevent Castle.Validator component to do it's job

Hello, everyone! I've run into the problem with NHibernate proxy validation using Castle.Validator component. It's looks like validator could not fetch attributes from entity proxy's properties. I've tried to define validation attributes using Inherited = true while Castle.Validator runner fetch em using following statement: property....