.net

What meaningful improvements can I expect from .NET 4.0 regarding XBAP?

I have been using XBAP with .NET 3.5 with mixed results. Integration with the rest of the page is difficult or non existant Security is very hard to get right Refresh time is not good (all assemblies are loaded again) State management is difficult Will .NET 4.0 improve things? Or should I switch to Silverlight? ...

Implement Date Time Picker functionality with MaskedTextBox. Validation done with RegEx

I am trying to create a Custom control specifically for my application which would be using maskedTextBox to restrict input data entered. Now i want to implement this in C#. class CustomDateMask:System.Windows.Forms.MaskedTextBox this.Mask = "00/00/2\000"; // For year 2000 and above, date format is "dd/mm/yyyy" this.ValidatingType = ...

File.Copy() sync or asycn?

I am using File.Copy(source, dest, true) to copy a file from local to remote with overwrite option. In my case, the dest is a mapped network drive: File.Copy(source, dest, true); UnMapDrive(); // unmap the network drive The problem I have afterward is that the source file may be locked so that I could not delete the file from local. ...

When should I use LINQ for C#?

Hi, I'm learning C#, and I find LINQ absolutely interesting. However what is boggling me is, I can't think of a scenario whereby using LINQ would be an immense help, as its really not that hard replicating LINQ features in code. Any personal experiences/suggestions you might wanna share? Thanks! ...

String was not recognized as a valid DateTime ParseExact

I am trying to parse a date in c# and have the following line of code DateTime.ParseExact(DateSelected, "ddd MMM dd HH:mm:ss zzz yyyy", Culture) when I debug DateSelected is coming in as "Tue Feb 16 12:36:41 CST 2010" but I get an expection saying "String was not recognized as a valid DateTime." ...

How System.ServiceModel.Web.WebOperationContext works when InstanceContextMode is Single?

If my WCF Service has this attribute: [ServiceBehavior( InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] How can the following a Singleton work in a call? System.ServiceModel.Web.WebOperationContext.Current ...

Creating objects from an interface in C#

It is possible, given only an interface, to create an object from this? Something like: var obj = new IWidget(); (I know this code isn't right - VS stays cannot create an instance of IWidget) I'm in a context where my project has references to the interfaces, and I want to create concrete objects and return them from a method - but ...

Exploring IronPython using dir() doesn't always yield results.

I'm playing around with IronPython and dir() does not always seem to work as I would expect. For instance: import clr clr.AddReference("IronPython") clr.AddReference("Microsoft.Scripting") from IronPython.Hosting import Python py = Python.CreateEngine() print dir(py.Operations) Returns: Traceback (most recent call last): TypeError: ...

Does type projection have an opposite, or is it still projection (or just mapping)?

This is based on my assumption that taking an object of type: public class Fruit : IBasicFruit, IFruitDetails { // IBasicFruit implementation public string name { get; set; } public string color { get; set; } // IFruitDetails implementation public string scientific_name { get; set; } public bool often_mistaken_f...

Failed to queue test run [...] Test run Deployment issue: The location of the file or directory [..] is not trusted.

I'm currecntly developping a sample orders management solution using VB.NET 2008, NHibernate, FluentNHibernate and Linq for NHibernate. On runtime, I get the following error: Failed to queue test run [...] Test run deployment issue : The location of the file or directory 'C:\Open\Projects\Examples[..]\FluentNHibernate.dll' is not t...

How to get FormValueProvider instance in a Custom Model Binder in ASP.NET MVC 2

I'm using the MVC 2 RC. I have a custom model binder that used to iterate over posted form values in MVC 1.0 like this: var values = bindingContext.ValueProvider.Where(x => x.Key.StartsWith("prefix")); foreach (var value in values) { /* do something */ } In version 2, I can't do this anymore. Apparently there are new implementatio...

How could I use Rfc2898DeriveBytes in window mobile?

I am carrying out a PDA version application from windows version. But found out Rfc2898DeriveBytes isn't supported by WM. So how could I do to replace this piece of code in WM and change nothing about the algorithm? Many thanks. ...

LINQ to SQL stored procedures with multiple results in Visual Studio 2008

I'm using visual studio 2008 and I've created a stored procedure that selects back two different result sets. I drag the stored proc on to a linq to sql dbml datacontext class, causing visual studio to create the following code in the cs file: [Function(Name="dbo.List_MultiSelect")] public ISingleResult<DataAccessLayer.DataEntities.Lis...

Generate HL7 CDA documents in .net

Hi, I am trying to generate HL7 CDA xml document from entity classes generated from CDA.XSD. Can any body help me on this. Thanks, ...

Converting WPF / ADO.NET Data Services application to the MVVM pattern - Examples

I have a WPF application which was written in C#. This application hasn't been written with any particular design pattern in mind, but as I have learnt .NET I've realised that the MVVM model would be suitable. Thus, I'd like to start converting the code. This will be the first time I've used MVVM, and whilst I'm willing to get stuck in,...

SQL NOT IN Clause

I have a query which is not working as expected Q1: SELECT id, name FROM vw_x WHERE id NOT IN (select pid from table_x) GROUP BY id, name Having max(c_date) > GETDATE() Q2: SELECT id, name FROM vw_x GROUP BY id, name Having max(c_date) > GETDATE() Q1 is not returning anything even though i know those ids are not in table_x Q2 run...

How do you implement Data Quality & Validation rules in a data warehouse?

I'm developing a datawarehouse to be part of my company's enterprise application suite. So I've been learning a lot about DW concepts but the rules engine seems difficult and I can't find much information about various ways to implement. The focus of the rules is to validate data quality, and also alert when certain business metrics ar...

C# user controls custom events

Is there a way to give a User Control custom events, and invoke the event on a event within the user control. (I'm not sure if invoke is the correct term) public partial class Sample: UserControl { public Sample() { InitializeComponent(); } private void TextBox_Validated(object sender, EventArgs e) { ...

Creating Events for change in some property value which is user defined

I am creating a custom control and i want to add some properties in it. On few of the properties i want to create some events. Say if i have a property public int Date {get; set;} now if its value is changing i want to trigger a change event. SO how can i add event on this ...

.NET and Messaging

I keep hearing about MSMQ and Biztalk for message processing, but I'm not entirely sure what this means. When these technologies are in place, what problems are messaging and these technologies addressing? ...