.net

Entity Framework: One<->Many<->One Mapping?

I'm trying to get a one to many relationship mapped with the EF and for some reason it's proving more difficult than usual. This is my EDMX and DB Schema. The reason I used an auto-increment key on the middle table is because I was told it's difficult to use composite keys with the EF. What I need is to be able to do (with a Course enti...

creating Virtual directory in IIS 7.0 using c#.net

hi ,i am trying to create virtual directory in IIS 7.0 using c#.net or vb.net, can any one guide me with that ...

Validate data using DataAnnotations with WPF & Entity Framework?

Hello is thee any way to validate using Data Using DataAnnotations in WPF & Entity Framework? ...

LinkedList.Contains. What is the mehtod used to compare objects?

LinkedList.Contains method. (.NET 2) How the objects are compared inside? (Equals? CompareTo?) MSDN tells nothing about. the situation: interface IClass { string GetName(); } class Class1 : IClass, IEquatable<Class1> { public string FirstName; public string LastName; string IClass.GetName() { return FirstName; } ...

My WPF application closes at weird moments

Hi guys! I have a really weird thing happening in my wpf application. Every time I close something (a dialog box, a window, etc...) the ENTIRE application closes, instead of only the window/dialog which is beeing closed. This not only happens when I call the Close method directly, but also when the element closes on it's own, eg: when...

Architecture for extension/plugin communication

Once the problem of loading plugins is solved (in .NET through MEF in out case), the next step to solve is the communication with them. The simple way is to implement an interface and use the plugin implementation, but sometimes the plugin just needs to extend the way the application works and there may be a lot of extension points. My ...

.NET Regex isMatch vs Matches question

Hi guys, yes it's another .net regex question :) (please excuse the long waffle leading up to the actual question) I'm allowing users to use simple date/time macros for entering dates quickly (they don't want a date picker) for example they can enter: d +1d -2h this will give them a date time string of todays's date, plus one day, min...

How do I use the DES Algorithm in .NET?

How do I use DES in .NET? Here's how I'd do it in Java: public static String decrypt(byte[] pin, byte [] desKeyData ) throws Exception { //if (ISOConstantsLibrary.DEBUG) System.out.println("original: " + pin + " key: " + ISOUtil.bcd2str(desKeyData, 0, 2 * desKeyData.length, false) ); String out = ""; try { ...

.net 3.5:how to implement calculate crc32 for data using dot net 3.5 api?

how to implement calculate crc32 for data using dot net 3.5 api.I have done the same in java with following code. public static String getMAC (byte [] value) { java.util.zip.CRC32 crc32 = new java.util.zip.CRC32 (); crc32.update(value); long newCRC = crc32.getValue(); String crcString = Long.toHexString(newCRC); ...

Most efficient way to create and write multiple 10 KB text files?

We're using the following approach to writing out text files: public void WriteFile(string filePath, string contents) { if (string.IsNullOrEmpty(filePath)) { throw new ArgumentNullException("filePath"); } if (contents == null) { throw new ArgumentNullException("contents"); } if (File.Exists(filePath)) { throw ne...

.net Satellite assembly?

How can i create satellite assemblies in .net 3.5? I have a nativetext.resx file in english and want to create assemblies for french and italian in different folders like it --> nativetext.resources.dll fr --> nativetext.resources.dll is there any too like AutoLocalize.exe(am not sure) ...

Reactive Framework for .NET examples that prove its usefulness

There's been quite some hype around the new Reactive Framework in .NET 4.0. While I think I undestood its basic concept I am not completely sold that it is that useful. Can you come up with a good example (that is halfway easy to understand) that totally shows of the power and usefullness of Rx? Show something that makes life so much eas...

How to create a thread-safe pool of objects?

In my server application (written in C#), I need to create a pool of same type of objects. I pull an object from pool when I need, and it goes back to pool when it is no longer needed. Mechanism needs to be thread safe since different threads will be asking and submitting these objects. I understand that frequently locking something to m...

Binding IsEnabled and other Properties to Public Properties, does it work like Dependency Properties?

In my scenario I have a lot of buttons or other controls which I want to depend upon a public property inside the code-behind file. Let's call this IsEverythingLoaded and it's a boolean. Now I would like to have a button look like this <Button Click="DoTheMagic" IsEnabled="{Binding Path=IsEverythingLoaded}">Click Me</Button> To...

HttpWebRequest.Address vs HttpWebResponse.ResponseUri

Whats the difference between these two properties? To put into context, I am determining if a redirect occurs if our ResponseUri != RequestUri. While a redirect occurs regardless the url http://adage.com/adages/article?article%5Fid=140560 will provide a different ResponseUri (http://adage.com/adages/post.php) than the Address (http://a...

How to use SHA1 or MD5 in C#?(which one is better in performance and security for authentication)

In C# how we can use SHA1 automatically?Is SHA1 better than MD5?(We use hashing for user name and password and need speed for authentication) ...

Collection replication using multicast

Hi, need a technology (open source or build myself) usable from C# that allows me to in one process maintain a “master” collection of objects (says a Dictionary of Customer objects) and in n other “client” processes maintain an in-memory duplicate of the “master” collection. All changes to the collection should only happen to the “maste...

Office Interop Word c#.net : Copying a table at a special location

I'm currently working on tables in a Word template with Interop. In my template I have a table which I want to copy (Copying will make it easier for me to fill in the data rather than inserting rows and column, because the template has a lot of write formatting). The new table should be inserted right under the original table. The best...

Unity view Registered Types during debug

Possibly a stupid question, but during debug I simply want to see the types that have been registered with my Unity container. I have tried going through the container in the watch window, but can't seem to find what I am looking for? I am expecting there to be a list of registered types somewhere? Thanks in advance ...

Catching exception types given as type parameters in C# 2.0

Hi, In the following method, the first catch block is never run, even when an exception of type ExceptionType is thrown: /// <summary> /// asserts that running the command given throws an exception. /// </summary> public static void Throws<ExceptionType>(ICommand cmd) where ExceptionType : Exception { ...