.net

How does Fluent NHibernate manage to get a reference to a property using that weird delegates?

For instance, if I want to map property Title I use: > Map(x => x.Title); That's weird because this delegate is only returning the value of the property and not the property itself while NHibernate needs to know the property itself. How does it work? ...

SVN post-commit hook doesn't open up GUI

Hi, I've created a form application in .NET which will be used in the post-commit hook. the problem is that the UI of the application is not shown. What may be the problem? Thanks. EDIT my UI should show Issue numbers of the developer. from there he should choose the Issue number that will be inserted to the log message. I've comple...

In ajax-pro Can I use custom class as proxy instead of system.web.ui.page? and How?

In ajax-pro Can I use custom class as proxy instead of system.web.ui.page? and How? basically I want to use html file with ajax-pro thanks for your time. ...

How do i cast an object to a string when object is not a string?

-Edit- Alternative question/example http://stackoverflow.com/questions/2486873/how-do-i-cast-a-to-object-to-class-b-when-a-can-typcast-to-b I have class A, B, C. They all can implicitly convert to a string public static implicit operator A(string sz_) { ... return sz; } I have code that does this object AClassWhichImplicitlyCon...

How to ensure DB security for a Windows Forms application?

The basic setup is classic - you're creating a Windows Forms application that connects to a DB and does all kinds of enterprise-y stuff. Naturally, such an application will have many users with different access rights in the DB, and each with their own login name and password. So how do you implement this? One way is to create a DB logi...

How do i cast A to object to class A when B can typcast to A?

Basically i want to do this. aa causes a bad cast exception. NOTE: o can be ANYTHING. It may not be B, it can be C, D, E, F etc. But this should work as long as o is a class that can typecast into A (B is such a class. It uses an implicit operator overload) var b = (B)"sz"; var a = (A)b; object o = b; var...

Moving .NET assemblies away from the application base directory?

I have a WinForms application with a bunch of third party references. This makes the output folder quite messy. I'd like to place the compiled / referenced dlls into a common subdirectory in the output folder, bin / lib - whatever - and just have the executables (+ needed configs etc) reside in the output folder. After some searching I ...

ShSetFolderPath works on win7, doesn't on XP

Hey. I'm trying to use ShSetFolderPath function in C#. I work on Win7, I've managed to use ShSetKnownFolderPath and it works fine. Since this function is unavaible in WinXP, i tried to invoke ShSetFolderPath. Because i'm not familiar with invoking, I've done some searching and found something on some French forum. I don't speak French, b...

One CSS per page in ASP.NET Theme

Does anybody know how to do this? Theme A style_for_x.aspx.css style_for_y.aspx.css Theme B style_for_x.aspx.css style_for_y.aspx.css Or even better: Theme A style_for_all_pages.css style_for_x.aspx.css style_for_y.aspx.css Theme B style_for_all_pages.css style_for_x.aspx.css style_for_y.aspx.css ...

Detect Symbolic Links, Junction Points, Mount Points and Hard Links

Hi, does anyone know how to check if a file or directory is either a Symbolic Link, Junction Point, Mount Point or Hard Link? As far as i know a symbolic links are detected by checking a file for its "ReparsePoint" attribute. Junction points are detected by checking a directory for the "ReparsePoint" attribute. So if the "ReparsePoint"...

How to catch ESC key press with WndProc?

How to catch an ESC KeyPress using WndProc? ...

Winforms ComboBox does not expand when clicked, any ideas?

Hi everybody, A ComboBox within a Form (modal dialog) does not open when clicked, however an item can be selected by using the up/down arrow keys. After clicking on another window and the back on the dialog, the ComboBox works as expected, i.e. expands on click. Weird... any ideas what could be causing this behavior? Thanks a lot in ad...

.NET project: unified wrapper for object databases.

I am considering doing a project which would provide unified API and tools (import/export, etc.) for object databases (e.g. Caché, Objectivity) for .NET. It would provide: schema generation from CLR classes, generation of C# classes from given OODBMs schema, API for deleting, creating and updating objects, Linq provider, API for calli...

How to use db4o IObjectContainer in a web application ? (Container lifetime ?)

I am evaluating db4o for persistence for a ASP .NET MVC project. I am wondering how I should use the IObjectContainer in a web context with regards to object lifetime. As I see it, I can do one of the following: Create the IObjectContainer at application startup and keep the same instance for the entire application lifetime. Create on...

.Net application settings path

By default in windows application setting are saved in this directory: %USERPROFILE%\Local Settings\Application Data\<Company Name>\<appdomainname>_<eid>_<hash>\<verison>\user.config Is it possible to change path for saving user.config file? For example save it in local folder? ...

Advantages/Disadvantages of different implementations for Comparing Objects using .NET

This questions involves 2 different implementations of essentially the same code. First, using delegate to create a Comparison method that can be used as a parameter when sorting a collection of objects: class Foo { public static Comparison<Foo> BarComparison = delegate(Foo foo1, Foo foo2) { return foo1.Bar.CompareTo(fo...

How can I programatically convert SQL data-types to .Net data-types?

Can anyone show me a way of converting SQL Server data-types (varchar for example) to .Net data-types (String for example). I'm assuming that automatic conversion is not possible? I have an 'EntityProperty' object and would like it to have an appropriate 'Type' property (string, decimal, int32 etc), at the moment this property is just a ...

Iterate over IP addresses

Let's say I have two IP addresses (in .NET, the System.Net.IPAddress class). How can I iterate over all the IP addresses between two given addresses? For example, let one address be 192.168.1.1 and the other 192.168.2.3. I want to somehow iterate over all the addresses in between and print them to the console. Thank you. ...

Win C#: Run app as administrator without UAC prompt

Hello, I need one of my .exe to always run as administrator without UAC prompt. My program will be installed with setup, which will have for one time admin rights, and I need to perform such step in this setup that my exe will be always executed as admin without UAC prompt. I've found 2 solutions so far: 1. Use custom service, which w...

Refresh Windows Explorer in Win7

My program sets "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" value "Hidden". Hovewer I'm not able to refresh the explorer to take into account this change. I've tried: 1) SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);` 2) SHELLSTATE state = new SHELLSTATE(); state.fSh...