.net

.NET: How to retrieve the body of an Oracle 9i PL/SQL procedure or function

DISCLAIMER: Let's just say I have a pet project to satisfy my insane desire to write a decent Oracle client that isn't based on Java, while appeasing my coding hobby. END OF DISCLAIMER What I'd like to be able to do is retrieve the schema information for subprograms, functions, package specifications and package bodies from an Oracle 9i...

Calling Directory.Exists("\\SERVER\SHARE\") in Setup Project

I have a .NET Setup Project to which I've added a custom installer action. During the setup process, the user has to provide a path (which often is a UNC path) to a share on their file server. I attempt to do some validation before proceeding to make sure the directory exists, as such: if (!Directory.Exists(serverDirectory)) { th...

Liskov Substition and Composition

Let say I have a class like this: public sealed class Foo { public void Bar { // Do Bar Stuff } } And I want to extend it to add something beyond what an extension method could do....My only option is composition: public class SuperFoo { private Foo _internalFoo; public SuperFoo() { _internalFo...

Why can I not close a form in C#?

I cannot close one of my forms programmatically. Can someone help me? Here's the code: private void WriteCheck_Load(object sender, EventArgs e) { SelectBankAccountDialog sbad = new SelectBankAccountDialog(); DialogResult result = sbad.ShowDialog(); if (result == DialogResult.Cancel) { this.Close(...

Is this still a closure?

The testit() method is a closure. aString has fallen out of scope but testit() can still execute on it. testit2() is using a variable that hasn't fallen out of scope (mystring) but which was also not been passed into testit2(). Is testit2() considered a closure? string mystring = "hello world"; Action testit = new Action(delegate { st...

SharpDevelop or Express editions

Since there is a Sharpdevelop 3.0 ( http://www.icsharpcode.net/OpenSource/SD/Download/ ) can anybody tell me how it compares to the Express Editions ? ( http://www.microsoft.com/Express/ ) I tried to find differences, but could only find this old post http://community.icsharpcode.net/blogs/mattward/pages/VisualStudioExpressComparison.as...

Stipulating that a property is required in a class - compile time

Is there a way to stipulate that the clients of a class should specify a value for a set of properties in a class. For example (see below code), Can i stipulate that "EmploymentType" property in Employment class should be specified at compile time? I know i can use parametrized constructor and such. I am specifically looking for outp...

Why would Application.Exit fail to work?

I have an application that has been getting strange errors when canceling out of a dialog box. The application can't continue if the box is cancelled out of, so it exits, but it is not working for some reason, and thus it keeps running and crashes. I debugged this problem, and somehow the application runs right past the Application.Exit...

Change web project to class library

Is there any way but copying the .cs files? Changing the .csproj file? But how? There is a related question, but I'm not satisfied with the answer: link ...

Harnessing the power of .NET Attributes

I would like to know if attributes can be used to "mix-in" functionality to a class / method / property. Something like: [TrackChanges] public Foo { get; set; } Does anyone how this would be implemented, if at all possible? ...

Is it possible use ASP.NET Sitemap to generate Breadcrumbs?

Hello. I want my ASP.NET site to have simple menu string aka Breadcrumbs. I have created Sitemap with all required elements and registered into Web.config. For example: <siteMap> <siteMapNode url="Default.aspx" title="Home" > <siteMapNode url="hosting/Default.aspx" title="Hosting" /> <siteMapNode url="software/Default.aspx...

Signed assemblies prevent my service from starting

When I sign the assemblies in my service with the Verisign signtool.exe, it fails to start when the machine starts, on a machine running Windows 2003 Server. The event log has two events: "Timeout (30000 milliseconds) waiting for the xxx Service service to connect." and "The xxx Service service failed to start due to the following error...

C# : How to put variable into meta tag

I have a html file need to refresh every 10 seconds, so I have this line in html : meta http-equiv="Refresh" content="10; url=Default.aspx" In my C# code I have this : public partial class _Default : System.Web.UI.Page<Br> { public static List<String> Active_User_List= new List<String>(), User_List_To_Remove; public static ...

ADO.NET Entity Framework generates unexpected, problem INSERTs

I need some help understanding the ADO.NET Entity Framework. I'm trying to represent and manipulate hierarchical data in a WPF TreeView control with the ADO.NET Entity Framework. Each of these Things has a single parent and zero or more children. My "delete" button... Private Sub ButtonDeleteThing_Click(...) db.DeleteObject(Di...

Best practices for executing SQL Server Scripts from a .NET Application?

What is the recommended method for executing a SQL Server script from within a .NET application and why? I'm in process of creating an application we can run from our installer to handle upgrading our database when a prior version of our application is installed. The database has a version table that I can programatically access and ...

Why does the 'sealed' keyword exist in .Net?

A large number of classes in the .Net framework are marked as 'sealed', preventing you from inheriting those classes with your own. Surely this goes against the nature of object orientation, where you can extend and redefine the behaviour of existing objects. Is there a good reason for the existence of the 'sealed' keyword? As an ex...

NHibernate HQL's Equivalent to T-SQL's TOP Keyword

What is NHibernate HQL's Equivalent to T-SQL's TOP Keyword? Also what is the non-HQL way for saying give me the first 15 of a class? ...

Enable multiple HTTP Methods on a single operation?

I have an operation contract (below) that I want to allow GET and POST requests against. How can I tell WCF to accept both types of requests for a single OperationContract? [OperationContract, WebInvoke(Method="POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageForm...

Show ContextMenu on Left Click using only XAML.

The default behavior of a WPF ContextMenu is to display it when the user right-clicks. I want the ContextMenu to show when the user left-clicks. It seems like this should be a simple property on ContextMenu, but it is not. I rigged it, so that I handle the LeftMouseButtonDown event in the code-behind and then display the context menu....

.NET: Painting (clipping) only part of a control?

I have a VB.NET program where I'm using a WebBrowser control to simulate a timesheet form. For data entry, I'm using a DateTimePicker control that sits on top of the WebBrowser control, which I have programmed to move on top of the cell of the table in the WebBrowser control when the WebBrowser control is clicked on. (If you want to ask ...