.net

Troubles with simple mocking using RhinoMocks .NET

I am trying to experiment with RhinoMocks, where I have to say I am a newbie and probably I don't get some obvious thing here. What I'm doing is something like : [TestMethod] public void SaveResponsibleUserFromChangeset() { var action = mocks.StrictMock<GenomeAction>(); var changeset = new ActionChangeset(); ...

Is it possible to combine two entities with different PKs?

I'm new to the entity framework so hopefully this is a really simple question... Can I combine these two entities? Here is the db... I want the final to be something like this... ...

How to get into Oracle development?

I'm a .net/c# developer but I need to set up an Oracle development rig. I have no clue about Oracle, and was hoping for some advice. Here are some things I'm interested in: What is licensing like? Is it possible to get copies of Oracle products for development just like we get SQL Server from MSDN? What operating system should I have o...

C# HttpWebRequest Form Post with Progress Tracking (for uploading potentially large files)

I've got a winforms application I'm writing that posts files to a web application (not mine). I've got things working just fine as far as posting the files themselves go, my issue is that I'd like to provide some indication of how far along I am with the sending the request. The code below is my attempt to use BeginGetResponse to that ...

How to control Type conversion in C#

Hi, Is there a way to control the type conversion in C#? So for example, if I have two types with essentially the same details, but one is used for the internal working of my application and the other is a DTO used for communicating with non-.Net applications: public sealed class Player { public Player(string name, long score) { ...

I need Microsoft.Practices.Unity and ObjectBuilder2 sources

Hello, Where can I get the sources for these 2 assemblies? I have some issues with them an would need to debug inside them. Basically the problem i have is that i register a class with container.RegisterType<Interface, Type>() and in some cases i get a new instance, and in other cases i get an old instance of the class. Edit: I...

How do I get the 48 least significant bits of a long formatted as hex?

long number = …; // string should contain exactly 12 characters string leastSignificant48bitsOfNumberAsHex = number.ToString("????") ...

Single Sign On for Web Application and Application in Virtual Directory

To enable single sign-on for a web application and a web application in a virtual directory, I set the machinekey in both apps to the same: <machineKey validationKey="xxx" decryptionKey="yy" validation="SHA1" /> The single sign on works just fine, but existing users can't sign in any more; their passwords are rejected. The machinekey ...

set cursor to pointer in a grid.

I have a Rad Grid and I simply want the cursor to be a pointer on hover of every row. I've tried Css classes and it hasn't worked. I know there is a simple solution, i just don't know how to do it. Below is what i've tried <style type="text/css"> .UseHand { cursor: pointer; } <telerik:RadGrid ID="RadGrid1" Skin="WB" runat="serv...

Should a User Control's Controls be backed by Properties?

Hopefully I am stating that right. I have a WinForm(3.5) app that has 1 Form that is broke into two regions. 1 is the Navigation and the other, a Panel, is the Content. You select what you want in the Navigation Portion, i.e. Demographics, and then it embeds a UserControl containing all the Demographics controls in the Panel. What I ...

If you attach an event to a form handler, and don't remove it, can the form and object be garbage collected when form closed?

Here is scenario. FormA loads. ClassA is instantiated at the form class scope. User does something that causes event ClassA.SomeEvent to be handled by method FormA.SomeEventHandler() User closes FormA Now what happens when the garbage collector makes its rounds? Since FormA should be disposed, but a reference to it is made by ClassA. ...

Using Decimal parameters in Firebird stored procedures

I have a Firebird stored procedure that accepts Decimal(9,6) values for Latitude and Longitude parameters. It's used to create a contact profile for a user. When I try to create and use these decimal parameters, I get a conversion error: Value was too large or too small for an Int32. Here's how I create the ADO.Net connection: Fb...

Is there a way to mark a class field to only be de-serialized and not serialized?

It sounds strange but this is exactly what I want because I am using a data structure named "Project" which gets serialized to a save file. I would like to be able to de-serialize an older version of a save file with deprecated fields in tact, but then re-serialize it using only the currently used fields. The problem is that I want to ...

Update Word doc's table of contents part automatically using .NET?

In Word 2007, you can right-click on a table of contents area and tell it to update its page numbers to point to wherever the current page of that link is. I'd like to do this programmatically, without COM, with the DocumentFormat.OpenXml assemblies. I'm having some troubles Googling it due to the nature of the phrase "table of contents,...

Get all the text under a element

My xml looks like this <Element> text <B>text<B></Element> Unknown number of B tags or tags even of a different name. How do i get the text from these? so it would be like this text text using linq to xml ...

Enumerable.Sum() overflowing

Hey, I'm using the Enumerable.Sum() extension method from LINQ to compute hash codes, and am having a problem with OverflowExceptions when the code gets big. I tried putting the call in an unchecked block, but that didn't seem to help. The MSDN documentation for the method says it will throw if the value gets too big, but I checked in ...

Catch keypresses in C#

I need to catch keypresses in my C# program that has a WebBrowser control in it. I know how to do it if there isn't any controls on the form or if I use a textbox or similar but the WebBrowser control seems to handle all keypresses itself. Is there any way to override the WebBrowser_KeyDown function? ...

How can I make this extension method more generic?

I'm having a brain fart trying to make the following method more generic such that any List<T> can be passed in for the columnValues parameter. Here's what I have: public static DataRow NewRow(this DataTable dataTable, List<string> columnValues) { DataRow returnValue = dataTable.NewRow(); while (columnValues.Count > returnValue...

Grouping using LINQ

I'm having a heck of a time with transforming a simple SQL Query into a LINQ query(using vb btw) Here is my SQL: SELECT USRDEFND5 FROM int_gp_employee GROUP BY USRDEFND5 The xml looks like this: <int_gp_employee> <row> .... <usrdefnd5>Some GUID</usrdefnd5> </row> </int_gp_employee> I've tried a number of di...

WinForms UserControl inheritance in .Net Compact Framework

The full .Net framework has an inherited UserControl but this option isn't offered by Visual Studio when creating a new control in a Compact Framework project. Manually changing the ancestor class of a user control to another user control results in an exception being thrown by the designer when subsequently trying to open it. Anyone k...