.net

Refactoring LINQ query

Consider the below if(type== "S") { lstItem.ItemsSource = (from item in Items where item.Property1 == "SomeValue" select item); } else { lstItem.ItemsSource = (from item in Items where item.Property2 == "SomeOtherValue" select item); } As can be figured out that the on...

Bundling only part of the prerequisites with ClickOnce

Is it possible to configure the ClickOnce installation so that it requires .Net Framework and VSTO but includes only the VSTO binaries and downloads .Net Framework if necessary? Including the VSTO in the package isn't too much of a problem but the 350MB .Net Framework is something I'd do away with if possible. (Dynamics CRM SDK depends ...

Writing Program for desktop that can switch to web

Hi guys, I am being asked to write a desktop application in .net and MSSQL for record keeping. I do have to build forms for keeping records printed in 15 pages or more related to single person. I am fine with seperating data layer and presentation layer. For future i am planning now. My client is gonna ask to make it live [web based] ...

Why doesn't EF 4 generate association for FK relation to column with unique index?

Hi all, I have run into a scenario where Entity Framework 4.0 does not generate an association to an entity backed by a table having a unique index, and I am wondering why. The basic setup is this: Let's say I have two tables in SQL Server 2008 R2 and a foreign key relation: CREATE TABLE [dbo].[User]( [Id] [int] IDENTITY(1,1) NO...

Mocking Enterprise Lib 5 'Database'

Is it possible to mock the enterprise library 5 version of 'Database'? If so... how? There is no IDatabase interface (which is a mystery as I though Microsoft P&P would be more on the ball about testability benefits of exposing such an interface). I have a Repository class which used EntLib 5 Data Access Application Block. I am retro ...

.net Webforms 5 steps data form data from client and submit to the server.

Hi guys, I like to ask what's the best way to submit a form with 5 tabs. Is like, i need to get some data content in input fields and the form contains 5 tabs in html, and i need to send all data to the server. My ideia is, send like a object to the server with my all data filled. Using cookie to saves the data than i'm choosing, and...

Event triggers don't work

I have some trigger in my Windows Phone 7 Silverlight app such as <Grid x:Name="ContentGrid" Grid.Row="1" Background="Red" Height="100"> <Grid.Triggers> <EventTrigger RoutedEvent="Loaded"> <BeginStoryboard> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Story...

Changing GUI of Windows Application based on the MSI filename

We are developing a Windows application using C#. We would like to change the GUI (background images and other control images and text) based on brandname. The typical installer of the application will be having the name brandname_programname.msi. We have to take the brandname from the MSI and allocate the GUI based on that. Please note...

Convert ISO 8601-formatted time period to ticks / miliseconds

Is there a built-in way in .NET 3.5 to convert an ISO 8601 period into a .NET TimeSpan / ticks / miliseconds? ...

Is there way to know through reflection that a method is from caller's assembly ?

Let's consider the following code : internal class FooInternal { internal static void DoIt() { throw new NotImplementedException(); } } Now i have a library inside which it is reflecting the FooInternal type and for a reflected methodInfo (in this case DoIt) i have this : if ((m...

Is it possible to handle columns as rows type design with an ORM?

I have a situation wherein to accomodate the need of dynamic addition of columns to a table, I am putting the columns values as rows in a table. As an example, storing of columns of an Address Table would be in the format: ID PropertyName 1 HouseNo. 2 Street 3 City 4 State 5 Country Now, if I need to create an O...

How to GroupBy 2 values in a Generic list, VB.NET ?

I'm using VB.NET on Framework 2.0. I'm looking to quickly group a Generic List<> by two properties. For the sake of this example lets say I have a List of an Order type with properties of CustomerId, ProductId, and ProductCount. How would I get the average of ProductCounts grouped by CustomerId and ProductId in VB.NET ? Unfortunatly I c...

How important is the context that is implied by a namespace?

Ok, the title might sound a bit vague but I really can't think of something clearer here. I recently was in the position where I needed a Point class, simply with two properties, X and Y and a ctor Point(int x, int y). Nothing fancy. Now this thing already exists in .NET, but this was in a library that handled certain objects on a map a...

Customize ClickOnce Insatller

Hi, I have created a plugin for excel using excel template in .net 2008. And i am packaging it using the clickOnce installer. My plugin is dependent on a external script, which i need to run once explicitly just like the installer. Is there some way by which i can add a step in installer to call this script? So that the user just needs...

PubSub between Java and .Net

Hi, Is there a good free service bus for .Net that allows subscriptions from Java clients? I'm working with NServiceBus and I like the fluent API and the simplicity, but it doesn't support Java clients or WCF integration for web-service based connections. Thanks! ...

Mac OS X Aqua interface for MS .NET?

Hi! Do you know any (free or commercial) libraries to make my Windows application look like Mac OS X Aqua app? Thank you! P.S. Do you know what unity3d.com used for their editor on Windows platform? ...

Minimum size that matches aspect ratio

I need to find the minimum size that has an aspect ratio of exactly (or within 0.001) some value. Are there any quick math tricks or framework tricks for doing this? Here's the pseudo code for the current bad idea I had running in O(n^2): epsilon = 0.001; from x = 1 to MAX_X { from y = 1 to MAX_Y { if(Abs(x / y - aspectRatio) ...

How can change font size on dot matrix report?

I want to design a double layer payslip and print on dot matrix printer. How can change font size on dot matrix report? If dor matrix report can't be change font size, and I change to standard report, but the printing speed is very slow, how can I solved?I want to design a double layer payslip and print on dot matrix printer. How can ...

Polymorphic element typenames using XmlInclude..?

I want to create a structure like: <root> <items> <myns:a s="a"/> <b s="a"/> </items> </root> Where the items in root are descendant from a common base class. I just cannot get it working. The following snippet creates <root> <items> <Base xsi:type="A" s="a"/> <Base xsi:type="B" s="a"/> </items> </root> [Serializable] [X...

Receving an error when calling WCF using a Service Moniker in Excel

I have a WCF webservice running that has 2 endpoints (mex and wsHttpBinding). The webservice is hostend on the address: http://localhost:2412/Service1.svc and its contact is named "WcfService1.IService1" I want to call this service from VBA in Excel. To that, I use the folowing code: mexMonikerString = "service:mexAddress='http://local...