.net

Runtime creation of generic Func<T>

I need to implement the method: object GetFactory(Type type); This method needs to return a Func<T> where typeparam 'T' is the 'type'. So, my problem is that I don't know how to create a Func<?> at runtime using reflection. Activator.CreateInstance doesn't work because there are no constructors on delegates. Any Ideas? ...

Can I stop a COM dll from displaying forms?

To be more specific: We have a web service (written in .Net) which utilizes a large number of COM dlls for core business logic (written in VB6). Assume for now that these are sealed libraries. Unfortunately, many of these COM libraries implement their own error handling or validation messages; if we pass in data which isn't complete, ...

How to locate dependency of .NET Framework 3.5

Hi all, I'm struggling with a deployment issue which leaves me completely lost. It goes like this: I have a Visual Studio Deployment project which installs an app - some assemblies each compiled to target .NET Framework 2.0. I have recently strong named them all (because one of the assemblies is a "Shared Add-In" for MS Word and MS Outl...

.Net Binary Serialization - How to Limit the Object Graph?

Hi, I have an object that I'd like to serialize and distribute between processes as efficiently as possible. The object itself has a reference to another object like so: public class Foo { // Unique Identifier: public int Id; public Bar Bar; } public class Bar { // Unique Identifier: public int Id; } The thing i...

How to Load assembly to AppDomain with all references recursively?

I want to load to new AppDomin some assembly which has a complex references tree (MyDll.dll -> Microsoft.Office.Interop.Excel.dll -> Microsoft.Vbe.Interop.dll -> Office.dll -> stdole.dll) As far as I understood, when an assembly is been loaded to AppDomain, it's references would not be loaded automatically, and I have to load them manua...

Where is the correct place to format a string in .NET?

We have a field called employee number in our database. It is char(10) field. we are storing the numbers right justified. so we are storing the numbers as " 1", " 2" etc. I am not sure why we started doing this because it happened before I started working here. Because of this, each function in the business logic that h...

Which Database is Good for Asp.Net?

I have been using oracle database throughout database courses, and I have programmed there a lot. However, now, I have to develop real life web application in ASP.NET and some people suggested me to use sQL server because it is more compatible with ASP.NET. But I did not like it at all using it, since, I got used to oracle programming, ...

Returning Business Object from Web Service

Picture, if you will, the following scenario: BusinessObjects.dll contains a class "BusinessObject" WinClient references BusinessObjects.dll Web Service references BusinessObjects.dll Web Service has a method: public BusinessObject GetBusinessObject() { BusinessObject result = new BusinessObject; result.Name = "MyBusinessObjec...

LINQ to SQL doing a Union and Left Outer Join

I have 3 tables. 2 contain lists of files that I need to do a UNION on to get all the unique files, then I want to do a left outer join against the 3rd table to find all the files that are in the 3rd table only and not in the other 2. To do the UNION I have the following: var imageUnion = (from img in dc.ImageT1 selec...

Removing literal strings in .net code.

What have you done to remove (Helpers/extension methods) string literal in code? e.g. I have nhibernate search criteria code like this all over the place. Expression.Eq("Status", LoginStatus.LoggedIn), “Status” being the property of an entity object used as a string in the case. Update: Primary reason in this case is to enable r...

What differentiates Nhibernate from other ORM’s?

Apart from the fact that it’s open source and mature, what are the differentiating factors that separate nhibernate from rest of the .net ORM frameworks like Subsonic, ADO.NET Entity Framework etc? Better put, why should I choose nhibernate over other .net entity frameworks? ...

Enterprise Library Exception Handling Application Block and Logging Application Block proper use in ASP.NET

I have a grasp on this application block with ASP.NET, but I feel unsure if I am coding with it properly in ASP.NET. I've looked all over for proper examples of how to use the Enterprise Library Exception Handling Application Block, but only turn up articles for Windows Forms. Could somebody please point me in the right direction for u...

Raising events asynchronously

I'm looking into options for doing asynchronous event dispatching in a component that has many subscribers to its events. In perusing the options, I ran across this example: public event ValueChangedEvent ValueChanged; public void FireEventAsync(EventArgs e) { Delegate[] delegates = ValueChanged.GetInvocationList(); foreach (De...

.net AppSettings historical trivia

One of the previous developers where I work habitually, consistently used: ConfigurationSettings.AppSettings["Foo"].ToString() It twigs me a bit since AppSettings collection items are already strings, but I got to wondering: way back in the ancient days of .net 1.0 and 1.1, did the collection store its items as type Object necessitat...

How can I increase the heap size .NET?

Is there something in .NET that corresponds to java -Xmx memory size allocation? ...

How difficult/time consuming is setting up a .net login page?

We're working on a SSO solution that allows users to log in via .net and then end up at a PHP app. I'm working on the PHP end, and after much work, I've decoded, parsed, and otherwise done things to the cookie that .net sets with the username and ticket expiration date. At least I think I have. My difficulty now is that the .net develo...

Sql Workflow Persistence Service does not save workflow state

Hallo everybody, I'm dealing with a pretty strange situation here. I have developed a State Machine Workflow and it worked just fine until today. Now, the Sql Workflow Persistence Service does not save the workflow state. There is no any exception, just it does not save the state. The flow is going normally to the Event Driven activity ...

Converting Assembly to byte[]

Hello, I am trying to convert an assembly compiled using ICodeCompiler into byte[]. How can I do that? Also what is safest way to transfer this assembly to some remote location (client)? Note that Symmetric Key encyrption is not a possiblity. Update: What about this? BinaryFormatter formatter = new BinaryFormatter(); Me...

Deleting Temporary Files after usage

Hi folks I need to work with some temporary files in my Windows Forms .NET 3.5 application. Those files are opened in an external application that can of course be running for a longer time than my own program. Are there any best practices to make sure these temporary files are cleaned up at any time in order to avoid filling the user'...

Why does my table have no content in ASP.NET?

I have built a table in a class GetData.cs public Table BuildTable() { Table tButtons = new Table(); TableRow tRow = new TableRow(); TableCell tCell = new TableCell(); long lColumn = 0; long lPreviousColumn = 0; long lRow = 0; long lPreviousRow = 0; long lLanguage = 0; long lPreviousLanguage=0; ...