.net

Display images from folder with Silverlight(Blend)

I have a network directory that has a dump of all employee pics here at our company. The images are named FirstnameLastinitial.jpg. I ultimately am trying to build a photo browser of these pics in Silverlight but I thought I would start with how to harvest the Pictures from that location. I would imagine that I should generate an XML ...

app.config not being renamed when built by an external project?

We are working on a solution with various projects inside of it, the bulk of which is inside our Domain class library. This project contains a app.config file with various settings. The stripped down structure of the solution looks like this: Solution Domain project app.config Integration tests project app.config...

WTSQueryUserToken Fails, getlasterror() returns 1723

I have a windows service that is running under the credentials of the system account. The service periodically polls windows for the active console session id, i.e. the interactive logged in windows user, and then retrieves the user token associated with the active console session id by pinvoking the wtsapi32.dll function WTSQueryUserTok...

Unit test for thread safe-ness?

I've written a class and many unit test, but I did not make it thread safe. Now, I want to make the class thread safe, but to prove it and use TDD, I want to write some failing unit tests before I start refactoring. Any good way to do this? My first thought is just create a couple threads and make them all use the class in an unsafe w...

C# and ADO .NET entity data models with LINQ associations and entities for the same table

My database tables are as follows: Users (UserId, Name) Friends (UserIdFrom, UserIdTo) I also have an ADO .NET entity data model that describes these tables. My .NET entity data model has an entity named Users and an association for that entity called Friends that corresponds to the Friends table. My question is that I want to get a ...

.NET Windows Forms datagridview - have to click combobox column three times to get focus

I'm making a Windows Forms application which has a standard DataGridView in it. The DataGridView has several DataGridViewComboBoxColumns in it. And they are a pain to work with. To get one of them to open up (as in, drop down the list), you have to click the cell at least 3 (!!!) times. Seems that the first click ends the editing of the ...

Passing parameters to a User Control

We are trying here to localize our user control basically we want to be able to do something like this : <in:Banner runat="server" ID="banners" Lang="fr" /> The way we do this is by page level and send it to master that then send it to the control: protected void Page_Load(object sender, EventArgs e) { Master.Lang = "FR"; } Th...

Free UML drawing library for .NET

Hello, I'm looking for a free .NET (C#) library which i can use in my program and simply draw UML diagrams (especially class diagram). I tried to used Netron Diagramming Library but it is kind of tricky. Thanks in advance. ...

Cross-Cutting Concerns in SOA architecture

i have several classes in my service layer. i want to before call methods of these(every class),call they method of a spesific class after the spesific class call them.how is that possible in c#? example at ASP.NET MVC : CONTROLLER CLASESES -> A SPESIFIC CLASS -> SERVICE CLASSES because i need to central logging,exception handling,ch...

Entity Framework: insert with identity column fails "sometimes" with OptimisticConcurrencyException

Hi all, While developing & learning with Entity Framework, I'm having a curious problem with inserts when I run the tests for one entity in my model. In concrete, the problem is when running some tests together. I'll explain myself: I have one entity in my model called "DtoCategoria", with 2 members: id:Int32 and name:string, mapped to...

XML Minify in .NET

I'd like to read in the following XML: <node></node> And then write it out, minified, like this: <node/> Obviously this has the same meaning, but the second file is smaller for sending across the wire. I'm trying to find a way to do this in .NET. I can't seem to find an option or setting that would drop unnecessary closing tags. ...

Popular .NET Compact Framework open source applications / components

In my company I am responsible for the development of a .NET CF application which runs on top of Windows CE. We have invested much time in the development of a GUI framework, a top-level design which handles authorizations and navigation on the device, a IoC customer, ... Now I was wondering if there are any other projects which show ki...

WCF - How to specify endpoint's contract in C# code?

How do I specify the contract in C# code? I want to remove dependency on config file, and getting error: Could not find default endpoint element that references contract 'TFBIC.RCT.HIP. Components.RCTBizTalk.WcfService_TFBIC_RCT_BizTalk_Orchestrations' in the Servic eModel client configuration section. This might be becau...

WCF extensions without including the assembly version

As discussed here, I'm trying to add a WCF endpoint-extension; I've got it working, but I need to include the full assembly details: <extensions> <behaviorExtensions> <add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net, Version=1.0.0.275, Culture=neutral, PublicKeyToken=257b51d87d2e4d67"/> ...

Creating a ASP.NET application converting text to speech

I seek some insight in creating an application that converts text to speech in ASP.NET. From my initial research, it appears that: MS SAPI requires the client to download an ActiveX component and can support large amounts of text to be converted. Our clients are not willing to install any components on their systems, so this approach m...

How to touch a file in C#?

In C#, what's the simplest/safest/shortest way to make a file appear as though it has been modified (i.e. its last modified date) without changing the contents of the file? ...

how to add sort direction with linq for sql ?

Suppose I have linq expression q, then I want to add a sort to this query: q = q.OrderBy(p => p.Total); but for sort, there is desc/asc option for SQL, how to add it in above linq expression? ...

.NET BinaryWriter.Write() Method -- Writing Multiple Datatypes Simultaneously

I'm using BinaryWriter to write records to a file. The records are comprised of a class with the following property datatypes. Int32, Int16, Byte[], Null Character To write each record, I call BinaryWriter.Write four times--one for each datatype. This works fine but I'd like to know if there's any way to just call the BinaryWriter.Writ...

Constant Values Required in Variable Declartion

We are using a custom API in our project which provide an attribute for class fields/members which lets the interface to present a popup of some range values like "On/OFF" and pass the corresponding values of the choice to our code. The attribute requires a string array to know that values. We have many enumerations defined for these ra...

Parsing "multipart/form-data" in .NET/C#

Hi all, Got a .NET/C# question... I need to parse some input post data thats in a "multipart/form-data" format to extract the passed username and password. Anyone know how to do this without writing my own parsing code? Note the input post data looks something like this: ---------1075d313df8d4e1d Content-Disposition: form-data; nam...