.net

questions about ORM mappers like nhibernate etc.

Hi, Few questions on ORM mappers like nhibernate (for .net/c# environment). When queries are run against a sqlserver database, does it use parameter sizes internally? paramaters.Add("@column1", SqlDataType.Int, 4) Do they all use reflection at runtime? i.e. hand coding is always a tad faster? does it support temp tables, table variab...

How can I easily chain two asynchronous requests together?

I've got some code that screen scrapes a website (for illustrative purposes only!) public System.Drawing.Image GetDilbert() { var dilbertUrl = new Uri(@"http://dilbert.com"); var request = WebRequest.CreateDefault(dilbertUrl); string html; using (var webResponse = request.GetResponse()) using (var receiveStream = webResponse...

Best IPC for VB6 and .net application

In our application (a document management system) we are supposed to be notified of screen changes (or notify the other program of screen changes) in order to keep the two applications looking at the same data, one being the order fulfillment app, the other the document viewer of the original fax. The fulfillment app is written in vb6 a...

Is there an HTML version of the ECMA-335 CLI Specification?

I'm currently writing a blog post about the internals of the CLI, and I try to cite where something gets said. Mainly in the Partition III docs. I'm currently linking to the ECMA page for it, where there are a bunch of pdf- and zip-files, and making section references where they are needed; but I would really like to link directly to t...

How can I pass a .NET Bitmap to a native DLL?

Here is what I have: An external DLL, I have written in C. This DLL links to opencv. I don't want to call OpenCV directly from C# - there are already huge amounts of C code accessing OpenCV which will be used in the DLL. There is an exported function: passbitmap(void *mem, size_t s); A C# project from which I want to call the DLL. A Sy...

DLL References fail with "Access Denied" when using Impersonation for a NON-Local-Admin windows user

We have a service using WCF and Impersonation. A user can log in to the client application with credentials that are part of an Active Directory system. The users login is impersonated service side. This works fine when the user who logged in is setup as a Local Admin on their host machine. But a problem occurs when they are a non-...

Retrieving items from an F# List passed to C#

I have a function in C# that is being called in F#, passing its parameters in a Microsoft.FSharp.Collections.List<object>. How am I able to get the items from the F# List in the C# function? EDIT I have found a 'functional' style way to loop through them, and can pass them to a function as below to return C# System.Collection.List: p...

Using a DSL to generate C# Code

Currently the project I'm working with does not have completely fixed models (due to an external influence) and hence I'd like some flexibility in writing them. Currently they are replicated across three different layers of the application (db, web api and client) and each has similar logic in it (ie. validation). I was wondering if the...

Can I create an undo transaction in Word or Excel? (VSTO)

I notice that Project 2007 has the functions that allow operations that can be undone to be placed in a single stack item, or "undo transaction". For example: Application.OpenUndoTransaction "Create 6 tasks" Dim i As Integer For i = 1 To 6 ActiveProject.Tasks.Add "UndoMe " & i Next Application.CloseUndoTransaction What this means ...

TFS vs SVN

I am about to start a project (.NET) and need to decide between TFS and SVN. I am more used to SVN(with tortoise client), CVS and VSS. Does TFS have all features available in SVN Have any of you switched from SVN to TFS and found it worthwhile? Also it looks like we may need Visual Studio if we need to work with TFS. [Edit] Money is n...

.NET HttpRequests using the Windows system Cache

I'm using either WebClient or HttpRequest/REsponse to make http calls for images. I'm not sure how caching specifically works for browsers, but is there a way to enable either WebClient or WebHttpRequest to use the systems "temporary internet files" cache that the browser utilize? Or, do I have to write my own disk cacher? ...

Same TableAdapter, Different DB

Hi, having to work in two parallel environments, developement and production, I want to use the same TableAdapter to connect to different databases (two Oracle databases running on different servers) with the very same structure. How is this possible? Thanks. ...

What do you think is an example of a well structured n-tier .Net application?

In the search for resources to become a better developer, I am looking for good examples of how to structure the code in n-tier applications. Like... What does the business object do and look, how does it interface with the data access layer etc. How does the UI interface the business layer, and does it interface the DAL directly. Do ...

Anonymous type collections?

I am looking for best practices for creating collections made from anonymous types. There are several approaches - this one and most answers on this thread assume that the whole anonymous collection can be constructed in one statement. As anonymous types are usually used to replace classes that are to be used to store temporary (as put...

How to implement conditional formatting in a GridView

I have a GridView on my aspx page which displays a collection of objects defined by the following class public class Item { public string ItemName{get; set;} public object ItemValue{get; set;} } Then in my aspx markup I have something like this <asp:GridView ID="MyTable" runat="server"> <Columns> <asp:BoundField D...

Can i request a MyOpenId persona's Avatar with dotNetOpenId?

Hi folks, some of my MyOpenId persona's have avatars. Is there any way to programmatically request them with dotNetOpenId, like i can request email, etc? I'm assuming it can't be done because i'm guessing they are not part of the standard openid schema? ...

Visual Studio 2008 - Distribute library with sample-application - ensure no access to the source-code of the library

I guess that this is a really stupid question, knowing that .net-code can be viewed with tools such as Reflector but here it comes. I have written a library in VS2008 (vb.net) which I am distributing to some people for testing. With the distibution, I am also attaching a sample-project(application) which uses my library. I thought that ...

How do you prevent IDisposable from spreading to all your classes?

Start with these simple classes... Let's say I have a simple set of classes like this: class Bus { Driver busDriver = new Driver(); } class Driver { Shoe[] shoes = { new Shoe(), new Shoe() }; } class Shoe { Shoelace lace = new Shoelace(); } class Shoelace { bool tied = false; } A Bus has a Driver, the Driver has t...

Iterate Through a Struct?

Hi, I would like to be able to iterate through the values of a struct in C# (.Net 2.0). This is to be done at runtime, with no knowledge of the possible values in the struct. I was thinking along the lines of either using Reflection to add the struct values to a list, or converting the struct to a data structure that implements the ...

Is there anyway i can convert a "Australia/Melbourne" time zone into some .net base class library object?

Hi folks, I have some data from a 3rd party that includes some string Language property data. Some sample data retrieved looks like : "Australia/Melbourne" When i investigated that what the property data-type was based on, it's a Zone Info (tz database / Olson database). Wtf is that? i googled and here's the info.... ZoneInfo da...