.net

Code Generation - Domain/model first (DDD)

I'm looking for a 'complete' solution for code-generation based on DDD or model first approach. Ideally, this would be a separate application or VS plugin that we could use and re-use to generate as much of the standard plumbing code as possible, preserving my custom business logic as well. I would like to generate VS projects, includin...

How can you reference a fully defined control as a resource within WPF?

I am aware I can reference styles & templates from a resource dictionary and I make significant use of them. But what about complete controls? I can declare a fully defined WPF control, like a button, within the app.xaml as a resource. For example, the app.xaml file defining a button would contain this: <Button x:Key="HelpButton" Cont...

Get Range of integers with linq

I'm looking for a way to compute the range of a give set of number for example. if I had H555,H567,H589,H590,H591,H592,H593,H594,H595,H596,H597 I would like output of H555,H567,H589-H597. I have looked through relevant questions and can not find anything like what I'm looking for. Thanks ...

Get internal size of an (infragistics Winforms 10.2) control with scrollbars in C#

How can I get the internal size of an (infragistics) control with scrollbars? The control.Size contains the control size on the screen but how do I get the internal size (total size behind the scrollbars)? Thanks, ...

Is there a .NET Testing framework that can assert a collection contains elements based on an expression?

I'm trying to test that a certain function I'm building will add objects to a collection when supplied with a collection of Ids. My test looks something like this: var someClass = new SomeClass(); var someIds = new List<Guid> { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() }; someClass.AddIds(someIds); Asset.That(someClass.IdsInClas...

c# - How to check if property setter is public

Given a PropertyInfo object, how can I check that the setter of the property is public? ...

What should I use to create a login system for multiple sites similar to SO?

I am in the process of creating a series of websites and web applications that will be hosted on a dedicated server that I own and host. They will be developed on Windows Server 2008, IIS7 and .NET 4, SQL Server 2008 and Entity Framework. This will be a live server as well as a place for me to learn how to do some new stuff. A user wil...

take picture and directly save image to pc using edsdk 2.8

Hello I'm new to this EDSDK 2.8 At the moment, my program can take pictures, However, when a picture is taken, that picture is temporarily stored in a buffer in the canon camera i would like to know how we could save it directory to PC? Does anyone have any ideas? or a sample code with c# or vb.net? thanks ...

Get all base property declarations within a class hierarchy

Consider this interesting set of types: class A { public virtual int MyProperty { get; set; } } class B : A { public override int MyProperty { get; set; } } class C : B { public new virtual int MyProperty { get; set; } } class D : C { public override int MyProperty { get; set; } } class E : D { public new int MyPro...

Change selection "style" in WPF

I have a chart with some lines in a WPF application. When the line is (mouse) selected by the user I need to change its look. à la : In WPF the two lines code could be as follows: <Line X1= "10" Y1="20" X2="150" Y2="20" Stroke="Black" StrokeThickness="1" /> <Line X1= "10" Y1="50...

Debugging .Net 3.5 code running under a .Net 4.0 App Pool

I have trawled the internet - to no avail. Woe is me. I have a .Net website running under a .Net framework 4.0 App Pool. The website references various assemblies that have been compiled for .Net 3.5. I have ensured that identical versions of the dll's and pdb's are in the bin folder of the the 3.5 code that I am trying to debug, and ...

dependencies between view, presenter and interface

Hi, I'm in front of a classic circular dependencies problem but the solution I've found (create a third assembly) does not seem to be ok with my view-presenter pattern. I need to reference my presenter in my view assembly I need to reference my interface(which are in the same assembly than the presenter) in my view assembly ok so I re...

Consume ASMX Webservice From Classic ASP Using SOAP Client 3.0

Hi, I made a webservice in VB.Net with a method returning a custom class or object. <WebMethod()> _ Public Function CreatePerson(ByVal LastName As String, ByVal FirstName As String) As Person Return New Person(LastName, FirstName) End Function Public Class Person Public Sub New() End Sub Public Sub New(ByVal LastNam...

Can a Delegate have an optional parameter?

I have the below code that was working fine until I tried adding the bool NetworkAvailable = true portion. Now I get a Method name expected compile time exception at Line 4 below. void NetworkStatus_AvailabilityChanged(object sender, NetworkStatusChangedArgs e) { var networkAvailable = e.IsAvailable; SetUpdateHUDConnectedMode d =...

How can I print Winforms DataGrid to paper?

How can I print a System.Windows.Forms.DataGrid to paper? I'm using .NET 3.5 framwork in C# ...

Recommended way to build a .NET project with selectable configurations

Suppose I have a .NET project that builds successfully. Now, I need to selectively build to different environments, such as DEV, QA, and PROD. Each require their own config files (app.config for instance) to contain corresponding connection strings and other settings. I've looked at simple pre-build scripting, such as this one from Sc...

Javascript to loop through all asp:Hyperlink controls on a page, and hide them

I have a master page which has a DIV with asp:Hyperlink controls functioning as the menu for the site. When I'm on a certain page if (document.title = 'Certain Page'), I want javascript which will loop through all asp:hyperlink controls on the page and hide them (i.e. set to not visible). I know I could probably do this on the server s...

referencing an interface

Hi, I have a question regarding interfaces. I understood that you cannot create instances of interfaces, right? However I see on a page demonstrating usage of IDictionaryEnumerator interface: // Loop through all items of a Hashtable IDictionaryEnumerator en = hshTable.GetEnumerator(); while (en.MoveNext()) { string str = en.Value.To...

Linq queries in Entity Framework 4. Horrible perfomance.

Hello, guys! In my project I'm using EntityFramework 4 for working with data. I found horrible performance problems with a simple query. When I looked at the profiler on a sql query, generated by EF4, I was shocked. I have some tables in my entity data model: It looks pretty simple. I'm trying to select all product items from specif...

Examples of MVVM application serialization design/implementation

I'm looking for some resources and/or examples of how to design and/or implement serialization for a .NET application, specifically an MVVM application. I've never really seen much attention given to this aspect of application design and development (that is, serializing application sessions to document files, in the way that Word or Exc...