.net

Catch Id (INT AUTO INCREMENT) of a Record after INSERT INTO Statement

This is my first time I use MySQL as datastorage for my C# Application, as I've seen that there is no UNIQUEIDENTIFIER type as in SQL server I decieded to use INT with AUTO_INCREMENT, my problem is now if I execute a INSERT, how may I get the ID of the Record I just added. My quick and dirty solution has been to execute a SELECT MAX(ID)...

Abstract base classes and appdomains

I apologize now if my upcoming explanation doesn't make enough sense; I'm reknown for it, though I try to do otherwise. I'm writing a service that makes use of user-defined plugins. I'm trying to isolate them -- keeping their assemblies out of the service's appdomain -- by making use of interfaces defined in a shared assembly. What's ...

ThreadAbortException

Let's say we have some code like this running in the separate thread: private static void ThreadFunc() { ulong counter = 0; while( true ) { try { Console.WriteLine( "{0}", counter++ ); } catch( ThreadAbortException ) { Console.WriteLine( "Abort!" ); } } }...

How to start another project in the solution in Debug mode

I've got a WCF host application which gets started by an executable with some dynamic parameters. Now I want to debug the this application but since it's getting started by the other tool VS.NET won't load it in debug mode. Is it possible to write some DEBUG only code to force it execute this process in DEBUG mode so it'll hit the bre...

Defining event handlers

I can define an event like this(declared function): MyElement.Keyup +=MyDeclaredFunction I can also define it like this(anonymous delegate): MyElement.Keyup+=new delegate(object sender, eventargs e) {}; I can also define it like this(lambda): MyElement.Keyup += (sender, e) => myfunction What is the best way to do this? One case...

Implementing a audio visualizer in WPF

I wish to implement a audio visualizer widget (similar to what Winamp has) in WPF. How would I approach this problem? ...

Disallow Text Selection in .NET WebBrowser

I do not want the text in my WebBrowser control to be selectable. How would I do this? ...

How do you use .net Reflection with T4?

Hi all, I have a c# project which includes a Text Template. I would like this template to generate some SQL based on reflecting against the C# classes in the project. How does one access the current project's contents using T4? Is it possible, and if so, is Reflection available, or is it access to just the raw source that must then be ...

How do I get the URI that threw a WebException?

I'm calling a method on a webservice and it is throwing a 403 Forbidden WebException... System.Net.WebException: The request failed with HTTP status 403: Forbidden. I've got this error logged but I'd really like to have the URI recorded in the log message so it is easy to determine which webservice is causing the problem. Is t...

Is there a way to get a ValidationSummary to work with client-side validators?

The .NET ValidationSummary control aggregates error messages from validators that are fired on postback. Is there some way of getting it to also show error messages from client-side validators? The problem I am working on is that on a long page, it is possible to click a submit button, have some client-side validators fail, but never se...

How hard is it to tamper with a strong named assembly?

Assume I have a .NET assembly which is strong named. Only I have access to the private key. I then distribute the assembly to some client system. How hard is it for the client to modify the assembly? Ie: what would they need to do to modify my assembly? ...

asp.net Dropdown menu does not show all the texts In IE,when the text is too long the rest get cut off

asp.net Dropdown menu does not show all the texts In IE,when the text is too long the rest get cut off,anyone can suggest any fixes for it.It works ok in firefox. ...

DateTime.Add(TimeSpan) performance vs DateTime.AddDays/Hours/etc* methods.

Is there any performance difference in using DateTime.Add(TimeSpan) vs. DateTime.AddDays(double), DateTime.AddHours(double), etc.? ...

what is the need of assembly ? why we use them?

what is the need of assembly ? why we use them? is it possible to program without an assembly? is the assembly is created automatically? suppose i develop an asp.net web project is there any assembly involved? could you list example? ...

Issue with fetching value from registry

Hi i am displaying version value from registry .For fetching value from registry i did the following code. // Where WrmSpoAgentRoot= @"Software\syscon\Point Monitor\"; string keySpoPath = SpoRegistry.WrmSpoAgentRoot; RegistryKey regkey = Registry.LocalMachine.OpenSubKey(keySpoPath); But i want to assign this value in t...

.net compact framework load picturebox image from a unc

Using .net compact framework, how do I load an image into a picturebox that is located on a network share? The handheld that application is running on is connected to the network by wifi. image is located on something like \\server\share\image1.jpg ...

Technology choice for redesigning an old VisualBasic-Application

Completely unexpectedly, I (a webdeveloper, with a decent knowledge in OO), am tasked to re-design our old flagship Windows-application and drag it screaming and kicking into the next century. Here's what we have now: 15 year old code, originally written in Delphi, about 8 years ago ported to Visual Basic (Kept in Visual Studio 2008)....

Can an assembly be executed or loaded within C#.NET COM component?

I have a COM(written in .NET) which needs to create a an AppDomain and load/execute .NET assemblies in it. So that I could unload that appDomain later along with all loaded dll's. While working OK in normal(e.g. WinForms) .NET app, I get security exceptions if this code runs from within COM context. Assuming that the COM assembly is stro...

Unit Testing the Data Access Layer

I want to test the data layer, how do I go about this? I am using NUnit for my business object testing. Must I use mock objects (which I have never used before)? I would appreciate any amount of input if someone can just guide me in the right direction. ...

ORM for GSQL, LINQ 2 GSQL ?

is there LINQ 2 GSQL implementation ? Note : GSQL is the query language (SQL subset) used in Google AppEngine datastore ...