.net

Entity Framework 4: Inheritance (table per type) - Derived table has a composite PK

Hi there, Is it possible to have "table per type" inheritance in the Entity Framework 4 if the derived table has a composite primary key? Here is my table setup: TABLE: ConfigurationKey (Base Entity) PK: Id TABLE: ConfigurationKey_Device (Derived Entity) PK: ConfigurationKeyId (FK to ConfigurationKey.Id) PK: DeviceId (FK to Device.Id...

The specified string is not in the form required for an e-mail address when adding BCC to .net mail

Hi All, I have added a bcc field to my email that I am sending out and getting the error in the subject line. Everything works fine when I comment out the BCC line so I am not sure what is wrong. Here is the code I am using (it is in Delphi .NET but the principal is the same as C# and VB): procedure TEmail.SendEmail(From, SendTo, CC, S...

LINQ DAL Generator.

Hi. Is there any software or provider or framework exist that able us to generate DAL layer with Linq To SQL? thanks. ...

validating csv file with xsd schema

Hi, i have to validata a csv file using xsd schemas that is provided with the file to validate. I was thinking to validate the file with datatable but the problem is that datatable doesn't accept some restrictions like minLegth and facets that i need to control some values. Is saw xmlSchemaSet but it validates xml files and i don't kno...

Improve performance of SHA-1 ComputeHash

I'm using the following code to do a checksum of a file which works fine. But when I generate a hash for a large file, say 2 GB, it is quite slow. How can I improve the performance of this code? fs = new FileStream(txtFile.Text, FileMode.Open); formatted = string.Empty; using (SHA1Managed sha1 = new SHA1Managed()) ...

ASP.NET DataGrid - How to access column count prior to rendering?

Hi, I have a datagrid with columns programatically populated. I need access to the columns to modify the sort expression prior to render, but the column count is 0 at every stage I try to access them. Break points are hit, but each check of the count = 0. Have tried the following, accessing in various stages of the page / control life ...

Serilization and Deserialization with .Net

I was currently discussing with a few friends on how to design easily serializable and deserializable classes. We are currently using a "home grown" attempt involving lots of spooky interfaces, custom attributes and loads of reflection which has by now outgrown the extend it was designed for. So we are looking for alternatives. Preferabl...

What are the disadvantages of implementing transactions away from the database?

We know that there are some scenarios that require us to implement transactions in code, such as SqlTransaction/TransactionScope in .Net framework. The questions are: What are the overheads (besides speed)? Does it gets worse if we add more layers between the transaction and the DB? If yes, then what are the overheads and what cause ...

string vs System.String, int vs System.Int32 : another Alias vs Type Name question

Quite often I see source code where language's keyword are replaced with full type names: System.String, System.Int32, System.GUID etc. Moreover, people who do this write complete type names everywhere, making source full of such declarations: System.Collections.Generic.List<System.Reflection.PropertyInfo> list = System.Collections.G...

How to start with database ?

Hi all, i have just started using visual studio 2008.I am working on c#. I want to add SQL database particularly LOCAL database (.sdf) to my project and want to use queries which will save data in database and fetch some data from database and which will display and will perform different function. So, if any body can give me any sma...

mvc.net multiple forms childaction

I have 2 forms on a page, they are included in the masterpage like so: Html.RenderAction("Form1", "Controller") and Html.RenderAction("Form2", "Controller") The Controller has the following: <ChildActionOnly()> Function Form1() As ActionResult Return View("Form1", New ModelObject()) End Function <ChildActionOnly()> <AcceptV...

removing xmlns from xml file

Hi I am Appending new Elements into XML file which is creating additional xmlns attribute and cannot be removed. i tried most of the common options here's my code This Add's new Entrys to the XML file Private Sub AddNewElement(ByRef FileInfo As System.IO.FileInfo) Dim bln As Boolean = False Dim XmlDoc As System.Xml...

Implementing a version history feature

We are implementing a version history feature in our ERP application (Winforms/WCF), and we are looking for the best approach, so far we came up with 2 solutions: 1) Save the object state as binary in the database 2) Save the property names and values of the object and reconstruct it later when fetching Or is there a better way to do ...

Array serialization performance issue

In my Windows Mobile (.NET Compact Framework) application I use a big array to store the application's primary data. This is a dataset of potentially hundreds of objects. Each object has about 10 or so properties and two arrays of itself, each with about 25 other objects, each of which has about 5 properties. To save this array on the m...

Encrypt a single key in the appsettings section of App.Config file

Is it possible to encrypt a single value or must you encrypt entire sections? I.e. Given the app.config below can how can I encrypt just the password. I've read articles on encrypting connection string sections and whole sections of app.config. <?xml version="1.0"?> <configuration> <appSettings> <add key="Interval" value="40000" /> <a...

How to customise combobox button look in WPF

Hi, Just wondering if anyone knows how to change the look of the button on a wpf combobox? In case you are wondering I just want to change the shape of it and the background. Thanks. ...

ThreadPool vs dedicated Thread - when to prefer which

Is there any way (apart form actual perfomance measurements which can be pretty hard to make them realistic) or rule of thumb when I should stop using the ThreadPool and use a dedicated Thread instead? I suppose for long running work it is better to use a dedicated Thread because it doesn't peramently steal one from the ThreadPool. For s...

How to solve: "exception was thrown by the target of incovation" C#

C# Every time I run my porgram I get this exception: But when I run in debug mode, there is no exception and the program works fine, what can I do? NOTE: I do not use invoke() anywhere in the project EDIT: Okay, here is the code found in the details: If someone know how to use protoBuff, and know this problem.... **************...

How to print .rtf file?

How to print .rtf file using C#? (WinForms/WPF application) ...

Problem creating an XElement object with GML namespace

I am trying to build a XML document using the GML namespace and XML to LINQ. My goal is an XElement with contents like this: <gml:name>...</gml:name> But I get the following: <name xmlns="http://www.opengis.net/gml" /> The problem is that the gml: is missing from the element. Why is that? My code is as follows: XNamespace ns...