.net

How to use Enum with aditional options (All, None)

I have an enum, which: is included in my class as a property it represents some values from a database table (a couple of types) it is displayed in DropBox, so that it can be used as a filter Now I would like to add 'All' (or 'None' for example) value to this DropBox. How should I do this: add 'All' value to Enum? add 'All' value...

WCF Exception: InvalidOperationException was unhandled

Since I'm contemplating to use WCF I thought it would be best to just follow a simple tutorial to get my feet wet. 3 hours later, I've only got one exception to show for. It won't go away. I ruled out the app.config not being loaded. If I change: wsHttpBinding in the config to JHGHJGH it gives an error when running. However when I ch...

Is it possible (with Moq) to stub method calls with Lambda parameters?

If I do this: var repository = new Mock<IRepository<Banner>>(); repository.Setup(x => x.Where(banner => banner.Is.AvailableForFrontend())).Returns(list); "Where" is a method on my repository that takes a Func<T, ISpecification<T>. AvailableForFrontend returns an implementation of ISpecification, and list is an IEnumberable of the gene...

Why do I get no line numbers from a stack trace created from Exceptions?

Okay; assuming this code running in debug mode - static StackFrame GetTopFrameWithLineNumber(Exception e) { StackTrace trace = new StackTrace(e); foreach (StackFrame frame in trace.GetFrames()) { if (frame.GetFileLineNumber() != 0) { return frame; } } return null; } I'm ALWAYS re...

unbound grid for .net

Hi all, can i have your opinion ? I want to develop .net winform application and i want to use fully unbound grid. Anybody ever use 10Tec iGrid.net and Xceed grid for .net ? which one is better ? Thank you. ...

Adding new fields to a form on change of one value C# .NET 3.5

I'm writing some form. I have one field in this form that contains a number. If this number for example is 3, i want this form to enable 9 new fields so i can add the values for those 3 new participants. <li> <asp:Label ID="lblAantaldeelnemendeploegen" runat="server" Text="Label">Aantal deelnemende ploegen: <...

Adding endpoints implementing different interfaces to an AJAX-enabled WCF Service

I have an AJAX-enabled WCF service and everything works fine with the ajax endpoint. Now I want to add another wsHttpBinding endpoint that corresponds to another interface that is subset of the AJAX interface (i.e. I want only specific methods to be exposed in WSDL). I have a class that implements both interfaces but when I visit the ser...

How to convert an anonymously typed List to List<T>?

This simple Linq query: from c in mycontext.Customers join o in mycontext.Orders on c.CustomerId equals o.CustomerId where o.Status == 1 select new {c, o} will result in List<{c:Customer, o:Order}> after calling ToList(). What's the easiest way of converting this anonymously typed list into a list of customers (List<Customer>)? E...

Protect assembly?

I have a .NET DLL (C#/VB) with custom controls, extension and other stuff. I want that it should be available for me only. Is there any way to restrict unauthorized access to a DLL? ...

What are most beautiful Silverlight charts?

We need most handsome Silverlight controls now. It is very important for us to have sexy animated charts. Please, advise. Here is one we found. EDIT: Sorry being lazy while creating this question. Please do not close it. To be more clear I'll list all our needs. We need speedometer-like chart, World-map chart, bar-chart, line-chart. ...

Help finding a Memory Leak cause

I have the following Leak situation in a VB.NET (.NET2) application: a form - DetailTache (TaskDetails) - in my MDI application is not garbage collected is not collected ofter open/close. I did the following profiling root: any idea how this leak could be fixed? thanks. EDIT: Result search from projet of WinComboRowSelected Event....

How can I duplicate a SPROC-table dependency graph after these SPROCs have been replaced with DALs implemented outside the database?

I need a solution for an enterprise environment with 100s of applications and SQL databases. A current architecture standard requires that all applications implement DALs using SPROCs. One reason for this is that, when performing ongoing migration, obsolescing or modifications to databases, dependency graphs between these SPROCs and data...

Check for entered text in WinForm App

I have a WinForm App(.Net 3.5) that we use in house for data entry...ish, like things. Member Plans, Demographics, etc. The App has a Shell Form with all the navigation and then embeds a UserControl based on there navigation choices. I need to be able to tell if they have made any changes in any of the controls so that I may pop up ...

WCF and Soap 1.1

I am trying to create a service that a 3rd party should hopefully consume. The consumer is compatible with SOAP 1.1, which is why I am using basicHttpBinding for the server. When the actual request is made, something seems to go wrong with the content types expected by the server. Using basicHttpBinding I dont get why the server still ex...

MVC generates two input fields for the same bool property. How do I stop it?

C#, MVC 2 RC 2... I have the following property on my model class: [Required] [DataType(DataType.Custom)] [DisplayName("Show Favourites")] public bool ShowFavourites { get; set; } And the following HTML in the view ASPX: <div class="editor-label"> <%= Html.LabelFor(model => model.ShowFavourites) %> </div> <div cl...

Best way to store many files in disk

I couldn't find a good title for the question, this is what I'm trying to do: This is .NET application. I need to store up to 200000 objects (between 3KB-500KB) I need to store about 10 of them per second from multiple-threads I use binaryserialization before storing it I need to access them later on by an integer, unique id What's...

Why does "Copy if newer" not copy a file when the file is updated?

I have a solution in Visual Studio Express that looks like this: The LogicSchema class in C# that will parse a specified XML file at run-time. The following is in the main method of Program.cs: LogicSchema ls = new LogicSchema( XDocument.Load( "schemas\\C#Schema.xml", LoadOptions.PreserveWhitespace)); I created ...

How can I lift the requirement to uninstall before installation of a .NET application built with Visual Studio?

Is it possible to build an installer in Visual Studio that will not require the application to be uninstalled prior to installation? (Assuming the application was already installed.) I use a Setup project in Visual Studio to create an installer for my Windows Forms (.NET) application. If the application has already been installed then t...

culture fallback

I assume the following code is Correct, CultureInfo culture = CultureInfo.GetCulture("en-US"); Assert.IsTrue(culture.GetConsoleFallbackUICulture().Name == "en"); but it is not, culture.GetConsoleFallbackUICulture().Name is still "en-US", I want to know what is the API to get the fallback culture. Thanks Jeff ...

NHibernate cascade and generated guid ids - why are they not generated for the children on save?

I do the following: var @case = new Case { Name = "test" }; // User is persistent and loaded in the same session User.AddCase(@case); // sets @case.User = User too Session.Update(User); response.CaseId = @case.Id; The cascade on User.Cases is set to All. But @case.Id is not set until the transacti...