.net

How to create generic WCF OperationContract to retrieve data from a SQL table.

I've been given the task of creating a .net interface for a table that will be retrieved a database. One of the obvious things that the interface must do is retrieve data from the table. So.... I could write a function that simply does Select * from MyTable; and then returns the result. However, the table has ten columns and someone u...

How to use WPF custom control properties in XAML Template?

Hey all, I've created a custom control that is intended to be used as a button but has properties to specify points for a polygon (to be drawn inside the button) and two colors for the gradient. I've declared all the properties in the code and then written the template in the XAML but it doesn't seem to be working. If I hard-code the ...

Visual Studio: Real time method call trace?

Hi guys, This is what I'm looking for: I'd like to be able to get a real time method call listing when I am debugging my program. So for example, say I run my program via the debugger if I press a button or do anything in my program I'd like for it to spit out, say on a visual studio plugin, in real time, all the methods it went through...

How to find all instances of a running program on all hosts on a LAN?

For practical purposes, what SqlDataSourceEnumerator does is find all instances of SQL server running on the various PCs on a LAN. Is there an equivalent for finding running instances of an arbitrary application? Edit: OK, so this only works because these apps have a pre-defined method of cooperation. Is there a straightforward way o...

Microsoft Application block DLL V2 and V4.1 references

My application is referencing Microsoft Enterprise library V4.1 while one of the older DLL (external application) requires a reference to Microsoft Enterprise library V2.0. I know for sure that i can register both of these assemblies in the GAC and the application will start reading relevant DLL as required but that is not a solution for...

Calling .NET Web Service (WSF, WS-Security) from Java - NullPointerException

I am attempting to create a Java client to call a .NET web service. I was provided a WSDL (which contains the security policy information) and used the Axis2 wsdl2java utility to generate the client stub. Here is the code I use to initialize the stub: ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFro...

How to resize a polygon in WPF?

Hey all, I'm working on my first WPF application and I'm testing out a custom control that is essential a circle with a play button drawn into the middle of it. I seem to have hit a bit of a hitch though. When I draw my play button I can't seem to get it to resize alongside the circle. Specifically, when I resize the circle to be wid...

Property Grid Color Picker control not allowing custom color editing

When using the Property Grid and exposing a color property from an object you get this kind of interface for color selection: There are tabs for System and Web, those are fine, but the Custom tab (shown) which seems to be a subset of the standard windows color picker, seems to be hobbled. How do you create custom colors? How do you ge...

Detect compiler generated default constructor using reflection in c#

First here is the scenario. I'm targeting 3.5 SP1 and I'm using CommentChecker to validate my XML documentation, everything works OK until I get to a class like this: /// <summary> /// documentation /// </summary> public sealed class MyClass { /// <summary> /// documentation /// </summary> public void Method() { } }...

List AD Groups with Access to a File or Directory in VB.Net

I'm writing code to parse through a list of file directories and identify which AD groups have access. That info is available in the operating system under the file properties security tab, but I can't find any code examples that retrieve that info in vb.net (or c#). Anyone have code that will do that? ...

SQL Server elevated permissions with integrated login

I have an application running in IIS which connects to a SQL Server 2008 R2 instance using windows integrated authentication. This application does simple read/write operations in the db using a set of stored procedures. I can restrict the privileges in SQL server quite well for this login/user combination. But for a small subset of the...

Override config file location for .NET class library?

I have a class library which I want to call from my .NET application as well as expose via COM and call from for example excel. This class library needs to get some values from a config file. When referencing from my .NET application I can of course just put the stuff it needs in the app.config. But I can't do this when calling from ex...

StructureMap and named instances

I'm not sure why the following doesn't work. StructureMap tells me there is no default dependency defined for SomeClassWithDependencies...um...dependencies. Can anyone shed any light on this? I want to construct the object through the entire dependency tree based on the named instances. Am I barking up the wrong tree? public class P...

Error while deserializing XML from SQL Server

I have an application which serializes and deserializes .NET objects to XML. While deserializing I am getting the following error: "There is an error in XML Document(1,2) Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 2. " The code snippet that does the deserializing is: string xmlEntity ...

Traverse ftp subfolders to get file sizes in C#

Hi all, Was wondering if you could point me at a right direction on how to achieve this... I'm currently working on an application that will check the filespace consumed in a remote FTP server that has folders, subfolders and files. I managed to get some information using System.NET via FtpWebRequest, FtpResponse, WebRequestMethods & ...

Web-Based Configuration Interface for Console Applications

I've been using app.Config and INI files to configure my applications but I wanted to make it more user-friendly. I've already encountered some applications ( most of them are java based ) that its configurations are via web interface ( I think the application is hosting jsp ). How can I do this on .net platform fast and easy? Thanks ...

Code contracts for .NET 3.5 messes up VS10's debugger

I've recently migrated a lot of manual precondition testing and exception throwing with code contracts. Instead of upgrading to .NET 4, I've been using the Microsoft.Contracts.dll assembly so I could stick to .NET 3.5 a bit longer (this is a library that is used both by .NET 3.5 and .NET 4 assemblies). I've set up the contracts rewriter ...

remove dot at end of text

i have to remove the dot at the end of text howt to i do usign c#, dot.net example = abc. i want this = abc ...

Custom user controls - how to add Code Collection Editor of type Dictionary<int, Color>

Hey there, I am fairly familiar with creating simple custom controls, but I haven't had this instance come up before, I wish to give design time changeability support to a "Colors" dictionary which applies a series of gradients to a custom control panel. Although using a simple public Dictionary<int, Color> ProgressValueColors does in ...

How do I do a Find operation with ReminderDueBy as a Paramater? [Microsoft.Exhange.WebServices]

I am using the Microsoft.Exchange.WebServices assembly and am trying to retrieve Appointments which have a Reminder set to go off in a certain time period. So basically I create a SearchFilter object using AppointmentSchema.ReminderDueBy: SearchFilter.IsGreaterThanOrEqualTo startTime = new SearchFilter.IsGreaterThanOrE...