.net

MsTest - executing method before each test

Is it possible to run specific method before each test? I know about TestInitialize attribute but this attribute has "class scope". If it's defined in Test class it will be execute before each test from this class. I want to define method that will be executed before each test defined in assembly. ...

How to map uint in NHibernate with SQL Server 2005

I have a property of type uint on my entity. Something like: public class Enity { public uint Count {get;set;} } When I try to persist that into the SQL Server 2005 database, I get an exception Dialect does not support DbType.UInt32 What would be the easiest way to workaround this. I could for example store it as long in the ...

XmlTextAttribute equivalent in DataContracts

Hi Is there an equivalent to XmlTextAttribute when using DataContractSerializer? I want to treate a property as the 'default property when it is serialized to XML. For example: [Serializable] [DataContract] public class Item { [DataMember] public String Value { get; set; } } A object with .Value set t...

updateing business object when selected index changes for drop down list with in a data bound control

Hello Friends, I have a repeater, which is bound to a Business Object, containing a textbox (Name) and a DropDownList (Date of Birth). how can i edit the bound object with the selectedvalue from the dropdown? For example The first Object has these values (Name: Dave, DOB: 1982) The second object has these values (Name: Tim, DOB: 1970...

IronPython + emacs?

I've decided to get into IronPython, as I work pretty much exclusively in .NET, but need something a little less stuffy than C# for mocking up quick stuff. Python has been fine for small things, throwaway tests, that sort of stuff, but it's to the point that I need to be able to get to some of our .NET code. Despite my complete revulsi...

How do I Turn negative numbers red?

I am working with a dataset, and will be returning both positive and negative currency figures. I already have a parenthesis around it. How do I get only the negative numbers in the gridview to show up in red? Can I do this on the HTML side? ...

Best practices for Active Record Pattern and using static methods for group operations.

It is true what they say about design patterns that they are simply the embodiment of techniques already in general use. I have been using the Active Record Pattern since 1985. One of the attributes of this pattern is the use of static members in the implementation to perform searches that return collections of the underlying data. cl...

Telephony event notification in .NET

Hello, I have a Windows Forms application, developed in C#, that would benefit from being able to receive telephony event notifications. For example, if office worker Joe answers a telephone call on his organization's PBX system, I need my desktop application to know it (as well as when he initiates a call, when he hangs up, etc.). I ...

Decrypt string C#

My company is in the process of taking over a members only website from a 3rd party. We have re-written the website and the last step is to import the existing users. We have the database with users and their passwords. We also were given the 'key' and were told that the password field is encrypted with AES encryption. I need to decr...

Alerting Library Users to an Inconsistent State

In a managed wrapper over a native library, I have to accomplish certain operations which to the user of the high level objects should be considered atomic and consistent. However, the underlying operations in native code are atomic and consistent individually, but not as a whole. // Simplistic look at the AddRange operation void AddRan...

MailMessage Mask From Email address

I need to send a email from application with text in the from field. I have the from email address, but how do I mask the email address so the from message renders the text not the email address? ...

Is there a global named reader/writer lock?

I have multiple asp.net web apps serving a set of files. Periodically, one will update the file before serving it, but it can't update the file if it is in use. I could solve this issue by using a named mutex where the name is the file path (replacing the invalid characters of course). I've used this in other situations, but you can see...

Deploying a Visual Studio Excel 2007 Template

I've created a project of type "Excel 2007 Template" in Visual Studio 2008, and I've deployed the project to a network share. After I run the Studio-generated setup.exe, what do I do to open the template? Is there supposed to an entry in the Start Menu? Show up in Excel somewhere? ...

Using static objects in XAML that were created in code in Silverlight

I couldn't get this to work in Silverlight, so I created two test projects. One simple WPF project and one simple Silverlight project that both do only one thing: set a public static readonly variable in code, and use it in a completely bare bones XAML. In WPF, works without a hitch. In Silverlight, I get the following compiler warni...

Fastest way to join mysql 4.0 data from multiple tables?

Hi, I have 3 mysql 4.0 tables: all have fields ID(int), type(int) and another field, value which is either varchar(255), tinyint or int. I need to write them all out and I end up getting three DataTables, looping over them, and creating rows into a temporary table (in .NET 1.1). Do you see any faster/cleaner way than this to join or ju...

System.UnauthorizedAccessException in mscorwks.dll causing app pool crashes

My app pools keep randomly crashing in IIS 6.0 MS Debug Diag points to kernel32.dll every time. The entry point is always mscorwks!CreateApplicationContext+bbef and the result is always a System.UnauthorizedAccessException. Stack Trace: Function Arg 1 Arg 2 Arg 3 kernel32!RaiseExc...

File encoding when reading a file with StreamReader

I am now having an issue where Celsius symbol gets read as C instead of °C. Looks like the encoding the culprit. I tried to do this: using (StreamReader sr = new StreamReader(this._inFilePath,System.Text.Encoding.Unicode ,true)) instead of using (StreamReader sr = new StreamReader(this._inFilePath)) but I a...

interface design with Linq2Nibernate and IQuerable

When using Linq2Nibernate is better to make you Repository return a IQuerable? My understanding is that if you use Linq to Nibernate the the query will not "fire" until you call .First() or Single() ect ect. So would it not be best to return IQuerable from all you Interfaces so you can build up\manipulate the expression tree before it ...

How do I setup an ASP.NET project *WITHOUT* using the Visual Studio GUI?

I'm using Emacs and Mono on Windows so that I can retain the same development environment while I'm in GNU/Linux. So I need to know what the directory structure of an ASP.NET project and which files are critical to its operation (config files, etc.). ...

.Net & C#: Trying to have a transparent image on a button (assigned from IDE)

Using VS2005 and C#. Having a button in a form and an image from a resource, the image does not have transparency. How can I have transparency when assigning the image from the IDE ? Thank you. ...