.net

.NET: Serialize objects into transactional environment

I need a way to serialize objects in a transactional context. Given the following pseudo-code: transation.Begin() try{ serializeObj(obj1); serializeObj(obj2); serializeObj(obj3); } catch(Exception){ transaction.RollBack(); } transaction.Commit(); I want that, after this code runs, or all the objects had been serialize...

timers in threading in .net

I want a timer tick/elapsed event inside a new thread. It seems like I cannot use the Windows timer. But if I use the Timers.Timer, it creates worked thread from the threadpool for each elapsed event. Is there a way to make these events to occur in the same thread? Update: Thank you everybody for answering this question. My intention...

Embeddable Cross-Platform Web Browser?

I'm wondering if there is a Web Browser that I can embed in my Applications and that is cross-Platform (Windows, OS X, Linux)? I'm undecided about the programming language, but I guess I'll have to go the C++ route (in which case I'd likely choose Qt as a GUI Framework) unless something for .net/mono or Java exists? Doesn't need to be ...

HtmlGenericControl and id

Hello, It's there a way i can control the ID of my HtmlGenericControl. I try to create my own HtmlGenericControl and override UniqueID, ClientID, onPreRender etc ... but nothing work ...

.NET4 error loading resources in assembly references of CSharpCodeProvider compiled assembly

I have updated an application to Target .Net 4.0. Part of this application uses CSharpCodeProvider at runtime to compile source code files to assemblies and use them within the application. The complier provider options are set to "CompilerVersion", "v4.0". When executing the compiled code which references a 4.0 external dll (added as re...

Resource Compiler question (initially posed as "UAC together with Subst don't work well together")

I am trying to run VS2010 with UAC on. ResourceCompiler complains that it cannot find a file located on a subst'ed drive. Here's a fusion log. *** Assembly Binder Log Entry (8/16/2010 @ 1:54:39 PM) *** The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified. Assembly manager loaded from: C:\Wind...

how to set the log file path of the SSIS package programmatically

Hi, I am executing SSIS package programmatically using C# and I want to set the log file for the package by reading the path from the web.config file. I looked at the code from the link http://msdn.microsoft.com/en-us/library/ms136023.aspx. but the package already has logging enabled and file name set to some location, I just need to be ...

Using extension methods in static methods on extended classes.

I have an extension method as follows: public static class PageExtensions { public static int GetUserId(this Page targetPage) { var user = Membership.GetUser(targetPage.User.Identity.Name); return (int)user.ProviderUserKey; } } Now in a page I need to use this method in a static WebMethod, so I have adde...

Common practices for SQL Server access from Windows Application on remote network?

Background We have a Windows .NET application used by our field employees who travel all over the country and live out of hotels most of the time. Recently we added some features that connect directly to our SQL Server 2005 for data access (i.e. SqlConnection.Open()). Since then we have run into some issues with this generating errors...

Why do we implement interfaces recursively?

I understand that any Collection (here I am talking about regular non-generic) should have implemented ICollection, IEnumerable and IList incase of regular object collection or IDictionary in case of Dictionaries. [Still, the question I ask is not specific to collections] IList is derived from ICollection and IEnumerable ICollection i...

With entity framework's self tracking entities, can I perform an explicit load?

I wish to return a graph for a "Business" entity. The Buiness entity has a collection of "Contacts". So I basically want this: ctx.Business.Include("Contacts").Where(b => b.BusinessID == id).Single(); The problem is I don't want ALL the contacts for the business. Just those that have a ContactTypeID = x. How can I accomplish this? I ...

Tips For Creating simple game .net

Hi. I am developing a simple backgammon. i Designed 3 pictures for the game. black not as png format white not ==>png format board jpg I have some questions about designing the game. I want to create it with .NET Framework 4, probably under windows I'm a bit familiar with WPF but not much. what is the best way for putting png nut o...

How to Get Custom Properties Common Profile ASP.NET?

How do I get access to my custom strong-named properties of the common profile (page.profile) in ASP.NET for a classes that does not derive from page? I thought I could just pass in httpcontext.profile but I'm missing the custom properties. There should be some class type that I can pass in? It appears the class type is ProfileCommon an...

Programatically switch betwen WiFi networks in .NET CF?

Is it possible to switch between WiFi networks in WM 6 and .NET CF v3.5 ? I'm writing a .NET Compact Framework v3.5 app for a Windows Mobile 6 device. I'd like to be able to switch between 2 different WiFi networks via C#. The first network is an Ad-Hoc wireless network with another device close by, and the second network is any other a...

How might I strongly sign an external DLL while retaining its assembly metadata?

I have a few libraries I use in my project that are unsigned. Because my application is strongly signed, the libraries must be as well. I sign these libraries using: "%PROGRAMFILES%\Microsoft SDKs\Windows\v7.1\Bin\ildasm.exe" /nobar /all /out=library.il library.dll "%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\ilasm.exe" /dll /key=My...

How do I efficiently compare LINQ expression instances for equality?

Possible Duplicate: Most efficient way to test equality of lambda expressions I was wondering how LINQ expression instances compare for equality. It seems that the expression classes do not implement IEquatable or IComparable or anything alike. Let me give you some background information: I've implemented a caching mechanism ...

Advice on Website Programming

Possible Duplicate: What should a developer know before building a public web site? Hi All, Im about to start building a website. It will basically be a simple dating site. I am a .net programmer (strong vb) with vast experience in application programming including winforms and silverlight. Now crossing over to website devel...

MsBuild and MsDeploy with multiple environments

Are there good patterns for mapping solution configurations to environments and using MsDeploy for packaging per environment? Shortest version: Grab this file, and try to change the .msbuild file so that a package is created. Details I have a solution with a large number of libraries and an ASP.NET MVC application. I drive the build...

WPF Grid & Collapsed Content

I've Got a Window with this basic layout: <Window MinHeight="72" MaxHeight="400" Height="Auto" MinWidth="460" MaxWidth="460"> <DockPanel> <!-- Footer --> <StackPanel DockPanel.Dock="Bottom"> ... </StackPanel> <Grid> <Grid.RowDefinitions> <RowDefinition ...

Programmatically enabling/disabling hardware device

Possible Duplicates: [.NET] How do I disable a system device? Win32 API function to programatically enable/disable device Is there a way, in C#, to programmatically disable and re-enable a device? I'm looking for essentially the same functionality that occurs when you go into device manager and right click on a device and di...