.net

Multiple Inheritence in C#

I do understand that there's no multiple inheritence in C#. However, I've run into a situation in which I really wish it existed. I am creating a custom class that requires me to inherit from CLR types and override a few methods. Unfortunately, I am creating several of these which are very similar. In the interest of DRY, I'd really want...

When is it NOT advisible to use an ORM like Linq-to-SQL / Entity Framework for a program?

Possible Duplicate: Are there good reasons not to use an ORM? I've just started learning what an ORM is and how it can help me save time and make applications more secure. Since this is new to me, after using ugly SqlCommands and whatnot in my C# code, this is the best thing since sliced bread. However since I'm new I might n...

Why is my .NET 2.0 ActiveX Control reporting it's version as 0.0.0.1 in IE's Manage Add-ons?

From the Details section of the property tab of my control's dll: File version 9.0.1.38589 Product version 9.0.1.38589 [assembly: AssemblyVersion("9.0.1.38589")] Shows up in reflector. However, for some reason Manage Add-ons is reporting the control as version 0.0.0.1. I've been unable to find any information on how this number is d...

"Reference" user control in web.config?

I'm looking to create an instance of a user control programatically in a codebehind of a web site*. The only ways I've found to reference the class of the user control programatically have been: Register the control in the web.config and drop the control on the page (works, but I don't want the control on the page as I want to dynamica...

Minimal message size public key encryption in .NET

I'd like to encrypt very little data (15 bytes to be exact) into a as short as possible (optimally, no longer than 16 bytes) message using a public key cryptography system. The standard public key system, RSA, unfortunately produces messages as big as its keys, that is about 100 bytes, depending on key size. To make things more difficul...

Proper error handling with 2.0 style and WCF proxies

Microsoft has provided surprisingly small amounts of information regarding this issue or I do not know enough about the problem to locate the documentation. When consuming web services using the traditional VS2005 and .NET 2.0 web service proxies, aside from FaultExceptions, what sort of communication exceptions can be thrown and throu...

Stuck on LINQ to SQL Query

I can't seem to translate this to LINQ: select stuff FROM history INNER JOIN profiles ON history.username = profiles.username LEFT OUTER JOIN files ON history.fileid = files.filename LEFT OUTER JOIN streams ON streams.identifier = history.fileid LEFT OUTER JOIN galleries ON galleries.identifier = history.fileid, su...

Rake on windows - copy directory to another server

Hi, I want to use rake to deploy a .net website to a windows server... Bit new at this and getting stuck with the very simple stuff... How would I copy a directory from a local folder to a different windows server? At the moment I have: task :default => :CWS_Web_application desc 'Depoly CWS Web application to preview environment' t...

Question about peverify errors

When I run the peverify utility against my .NET exe, I get a few errors (classes, methods renamed): [IL]: Error: [myapp.exe : namespace.class::method1][offset 0x00000027] Instruction cannot be verified. [IL]: Error: [myapp.exe : namespace.class::method2][offset 0x00000027] Instruction cannot be verified. [IL]: Error: [myapp.exe : name...

multiple Informix .net data providers in gac

Hello, I have an application that connects to informix that is written in vb.net. I previously had this application working on a server with .net 3.5 installed. I then attempted to upgrade the server to .net 4.0 along with an upgraded application. That broke the whole application. I then uninstalled .net 4.0, rolling the server back ...

Can't load xll programmatically

I'm trying to automating some tests for an Excel add-in, which is in xll form. I have some problem in loading the xll. I'm writing it in C# and my code looks like this: using Microsoft.Office.Interop.Excel; Application xlApp; Workbook xlWorkBook; Worksheet xlWorkSheet; // create application, open workbook, etc ... // now try to regi...

Doing joins with SubSonic/ActiveRecord easily?

Hello, I am using SubSonic with the ActiveRecord template. I like it pretty well so far but can not figure out how to do a join query. I have read this link but the generated class templates it creates does not have anything of type IColumn Is there something I am missing here? Also, I am using SubSonic 3.0 ...

What's the epoch of DateTime(Int64)?

What's the epoch of DateTime(Int64)? ...

Content Disposition Issue in C#

I am setting the disposition of either inline or attachment based on users selection. It works but very intermittently. Once I select inline for the same file in the same browser, it works as expected. Once I switch to attachment, I don't get the desired results unless I close and reopen the browser. I do flush the context and clear it a...

How do I open a file that is part of my solution?

I have a document that I have included in my VS 2010 solution. It is in a folder called "MyFolder" the file itself is called "MyDoc.docx". I've tried the following ways to open the file but none work: Stream s = File.OpenRead("/MyFolder/MyDoc.docx"); and Stream s = File.OpenRead("MyFolder/MyDoc.docx"); and Stream s = File.OpenRe...

Render Control to Html Produces a different string

I am trying to render a hyperlink to html. ( etc) When the page loads it works fine. (and lots 10 links) on the update panel it hits the same function and tries to get another 10 links. I set the navigationURL to something like "../Folder/Mypage.aspx?498592ghjgfosdfgo" It is set identically both times(load and updatepanel postback)...

why SaveChanges invokes when i'm debugging?

I am developing application using Entity Framework. When i'm in debugging mode my test values are saved into database when i exit debugging even if i'm not hitting SaveChanges method. Why is this happening? I spent 4 hours trying to figure it out, but had no luck.... Even if i have my breakpoint at the start of the action, and i ex...

Is Work Flow good for tracking lots of items in an automated system?

Is Windows Work Flow (WF) good for tracking lots of items in a warehouse? Say for example I have a warehouse that has 20,000 packages move through it a day. Those packages arrive and move around to 0 to 5 locations in the warehouse using a semi-automated system and then move to a storage location for a while. Is WF a good technology t...

Allow literal . in regular expression

^[a-zA-Z]:{1}/(\w+/)+$ I want to allow . as well in the expression in \w+. How can I do this? ...

Multithreaded file writing

Guys, I am trying to write to different pieces of a large file using multiple threads, just like a segmented file downloaded would do. My question is, what is the safe way to do this? Do I open the file for writing, create my threads, passing the Stream object to each thread? I don't want an error to occur because multiple threads are ...