.net

Dataset update issue

Hi! I load a table from the db in a datatable belonging to a dataset. This db table has some constaints, so not any data can be inserted in it. but if i add some invalid data within the datatable, when i do the "dataset.update()" operation an exception will be thrown, and any valid data inserted after in invalid rows will be lost. Is t...

How to check for valid Date in yyyyMM format

I have an internal business process that my finance dept runs. To kick it off they input a Date in the format of yyyyMM or 201009. I want to check for a valid date from that string but so far I got nothing. I am currently exploring breaking the string up, taking the first 4 and checking that they are between 1990 and 2050(as example) ...

Dependency property in User Control is null after assigning value

I have a user control, has a Frame as a dependency property public partial class NavigationBar : UserControl { public NavigationBar() { this.InitializeComponent(); } public Frame NavigationFrame { get { return (Frame)GetValue(NavigationFrameProperty); } set { SetValue(NavigationFrameProperty,...

What does dotTrace Performance Profiler mean by [Garbage collection]?

What does [Garbage collection] mean in this pic? And the "20 calls" thing? I mean, how can I figure out why GC took so long? Was it collecting a lot of small objects? A single big one? Any hints as to how to optimize this at all? The code in question is: private void DeserializeFrom(SerializationInfo info) { Width = info.GetInt3...

Log4net does not write the log file

I created a simple szenario using Log4net, but it seems that my appenders does not work because the messages are not added to the logfile. I added the following to the web.config file: <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false"/> </con...

Create a entity data model mapping to pocos that exists in another assembly and different namespaces

I have the following layout in my project (quite simplified): Assembles App.WinClient <--- client App.Service.Api <--- Contains models/businessobjects and service interfaces App.Service <--- service implementation Namespaces I got the following namespace layout in App.Service.Api App.Users (contains User, IUserService etc) App....

What's the difference between CellClick and CellMouseClick?

Is it only in the event arguments that get passed into the event handler? i know you can get which button made the click in the mouse event, but is that the only difference? ...

How to deal with the telnet negotiation

Currently I'm tring an telnet client sample written by C# to connet a data acquisition unit, I could connect the server and send the commands, but I always received the same data (I cound't post images, the data is{255,253,3,255,254,1,255251,1}). I also do some research, seems this problem is related telnet protocol/negotiation, but I do...

.NET serialization of Array to XML. How to set an alias for array type?

Hi I'm trying to figure out serialization of .net arrays to XML. Here's a piece of code that I've come up with: public class Program { public class Person { public string Firstname { get; set; } public string Lastname { get; set; } public uint Age { get; set; } } ...

ASP.NET: Custom control that outputs multiple hyperlinks. How do I register the ClientIDs for AJAX (UpdatePanel)?

I have a custom control which is rendered as a hyperlink: Public Class TestControl Inherits System.Web.UI.WebControls.WebControl Implements IPostBackEventHandler Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements System.Web.UI.IPostBackEventHandler.RaisePostBackEvent Trace.WriteLine("Hyperlink 1...

How to deal with the immutability of returned structs?

I'm writing a game that has a huge 2D array of "cells". A cell takes only 3 bytes. I also have a class called CellMap, which contains the 2D array as a private field, and provides access to it via a public indexer. Profiling showed that a performance problem is caused by garbage collection of too many Cell objects. So I decided to make ...

Data Annotations for a subset of properties

I've been reading up on Data Annotations (i.e. Scott Guthrie's blog post) and I am thrilled about the concept of having validation logic in one place. Has anyone been able to use this technique successfully when prompting the user to enter a subset of the properties associated with a given class? For example (pseudocode)... public c...

Make all controls on a form read-only at once

Anyone have any have some code to make everything (or even all TextBoxes in a form) read-only all at once without having to set every control to read only individually? ...

How to execute code as a part of the LINQ query

I have a query that looks like this: var results = from person where <here I need to do something like if person is of type Employee, call person.GetSalary() > 100000 but if the person is of type Contractor, I need to execute several lines of code before doing a person.GetSalary() > 100000 sele...

Command Param for making console invisible

I am firing up a cmd console from my .net app with some parameters, is there a parameter to specify that the cmd console is not visible? ---- Edit - Adding Code I know this isn't the standard way of starting a process in .Net, but it is being run from a Silverlight Client. Dynamic cmd = AutomationFactory.CreateObject("WScript.Shell"...

where to find statistics about .net developers worldwide

I am looking for some statistics about .net developers which works with vs 2008 and language c#, worldwide. Is it possible to find such specific information? If someone has actual information, at least 2 years young, please help me. And one thing more: I preffer to have charge free information:)! ...

What is the fastest method of retrieving TFS team projects using the TFS SDK API?

I have some answers! Feel free to contribute your own findings. As far as I know, there are 3 main ways to retrieve a simple list of Team Projects from TFS: Using the new Catalog service (TFS 2010) Using the VersionControlServer (TFS 2008/2010) Using the ICommonStructureService (TFS 2008/2010) The simple tests I conducted compared t...

How do I deal with the reentrant call pattern in WCF?

Imagine a duplex WCF service that contains a list of subscribers. At some point the service sends data to all subscribers, and some of them may immediately call into the service again. The ConcurrencyMode of the service is Single, so this call fails with an exception. I would like to avoid that exception and found two possible solutions...

Differentiating update of entries (business logic objects)

Hello, The situation I'm facing is as follows: There are large number of 'flat' files from which data is extracted by a C# app in order to create entries which are in turn written in a database (MS SQL server). A full release of the database comprises of ~ 97 million entries across 220 GB. The task is to create a differential update ...

Entity framework date/time conversion for sqlserver

I prefer working with DateTime.MinValue, even if I use SqlServer as backend. Is it possible to make EntityFramework to convert from DateTime.MinValue to 1753-01-01 when saving entities and convert back to DateTime.MinValue when fetching them? Edit: I do not want to use DateTime? (nullable value type) ...