.net

Testing Data Model in project that uses NHibernate for persistence

I'm still new with NHibernate, so correct me if I'm wrong on any of this. When you are using NHibernate to build collections of objects from database records, NH takes care of instantiating your collections and populating them. How do you instantiate your ISet collections when you are writing tests that don't actually use NH? ...

Reflector doens't show class implementation

Hi, I'm trying to decompile a library but when I click on a class name or a method name, the implementation code is empty. For example: public bool MethodOne(string str) { // nothing } What could it be? ...

Books on Unity or MEF

Anyone know if there are any books on Unity or MEF coming out in the next month or two? ...

Winforms RichTextBox: How can I scroll the caret to the middle of the RichTextBox?

I want to scroll a RichTextBox so that the caret is approximately in the middle of the RichTextBox. Something like RichTextBox.ScrollToCaret(), except I don't want to put the caret at the very top. I saw Winforms: Screen Location of Caret Position, and of course also saw the Win32 function SetCaretPos(). But I'm not sure how to tra...

Detect DNS Redirect in .NET

In a .NET application I am writing, I need to detect whether a particular URL is available. For the average user with a default DNS server, an invalid address would end up throwing a WebException. However, at home I am using OpenDNS. When I request an invalid address at home, the automatic OpenDNS redirect makes .NET believe the reque...

How to raise an event across classes and module

I have a WinForms class that presents a TreeView of some network nodes. I have a separate module that interfaces with the network and detects when nodes are added or removed. I would like the module to trigger the TreeView when the network changes. Example Public Class Main Friend Sub TV_Main_Network_Click ( ByVal sender As Sys...

Returning Entities + Extra Data with ADO.NET Data Services

Trying to figure out the best way to accomplish this. So I have a table of Stores with properties: StoreID, Name, Latitude, Longitude, etc. I'm using ADO.NET Data Services (Astoria) to create a web service that will show nearby stores given a radius and a coordinate. I made a Service Operation to take the params and return the result...

How do you return something in a ActionFilterAttribute?

Hi I am trying to use the ActionFilterAttribute in asp.net mvc. What I want to do is check if the users subscription is expired if it is I want to redirect the user to a page if not then do nothing. But the methods that you can override are all void. So how do I do this? Like I don't even know how to unit test it either since it is voi...

.net regex group that doesn't appear in matches

is there a way to group a matching element but not have that match appear in the resulting match groups? for example, suppose I have a string with two lines: <td>text 1</td> <td><a href=whatever>this is</a> text 2</td> and I want to parse out "text 1" and "this is text 2". what I'm doing now is using this pattern: <td>(<a href=.+?>)?...

What is the requires/provides design pattern used by the T4 RequiresProvidesDirectiveProcessor class?

The MSDN Library documentation for the RequiresProvidesDirectiveProcessor class in the Microsoft.VisualStudio.TextTemplating namespace refers to a design pattern called "requires/provides". What is this design pattern? "The abstract base class for a directive processor that defines and implements a design pattern called requires/...

Is there a dictionary like collection that can use a property of its value as the key?

istead of using Dictionary I want some type of collection class that can use a property of the value as the key, is there something like this? ...

Sybase ASE character set with OLEDB .NET

Using the .NET Framework 2.0 on a computer with the LCID set to 1033, I am connecting to a Sybase ASE 12.5.4 server which has its default character set to sjis. When I retrieve fields which contain Japanese text, I must, in code, convert each field from cp1252 to cp932 to display the text properly. However, when I set the computer to L...

What IPC method should I use between Firefox extension and C# code running on the same machine?

I have a question about how to structure communication between a (new) Firefox extension and existing C# code. The firefox extension will use configuration data and will produce other data, so needs to get the config data from somewhere and save it's output somewhere. The data is produced/consumed by existing C# code, so I need to deci...

Not calling Delegate.EndInvoke can cause memory leak... a myth?

There have been a lot of discussion around this and everyone tend to agree that you should always call Delegate.EndInvoke to prevent a memory leak (even Jon Skeet said it!). I always followed this guideline without questioning, but recently I implemented my own AsyncResult class and saw that the only resource that could leak is the Asyn...

IL Compiler for .NET?

This may be a dumb question, but is there a compiler for IL code, similar to that shown by Reflector in IL mode? ...

Why do my captures not work in .NET regex?

I'm parsing some text (admittedly HTML, but it's small stuff, and RegEx (should) do the job fine). I'm trying to use some captures, but they just don't do what I think they should. Match m = new Regex("(.*?)<br>(.*?)/(.*?)/(.*)", RegexOptions.None).Match("word<br>stuff1/stuff2/stuff3") CaptureCollection c = m.Captures; To my mind, c...

Nhibernate - No Class Mappings!

Why don't I have any class mappings after calling Configuration.Configure()? Here is my class mapping file Category.hbm.xml for BudgetModel.Category: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="BudgetModel" namespace="BudgetModel"> <class name="Category" table="Categories">...

FormName.Show won't work

When I try to show a form, I have to use ShowDialog instead of Show. (This is causing problems later in my code.) When I use show, the form pops up for a second and then the program closes. (VB.Net 2003) ...

NHibernate - mapping classes that implement multiple interfaces

I am using the Table Per Subclass strategy to persist an inheritance heirarchy: I am running into some confusion as to how to map the Debit class, which implements 2 interfaces. I may be overthinking it; I'm still learning NH. Thanks for any input. EDIT What's confusing me is that the only properties that my concrete classes have, th...

authentication integration issue

Hello everyone, I am using SharePoint 2007 Enterprise + Publishing portal template + Windows Server 2008. I am developing using VSTS 2008 + C# + .Net 3.5. I need to implement SSO (Single Sign On feature) with another site. The SSO protocol is like this, The other site will send me information like http://mysitename/default.aspx?Identi...