.net

NHibernate many-to-many mapping to existing objects

I'm having some issues with a many-to-many relationship I am trying to create. The goal is to save a customer and which products they are allowed to purchase. The products are not unique to a customer and will ALWAYS exist in the database before we try to associate a customer to them. My mapping for the association currently looks lik...

WPF datatemplate ItemsControl specifying initial and final values

I have been using ItemsControl for quiet sometime in WPF. I am using MVVM for developing my application. Now I have run into a problem. I have a requirement where in based on number of values in a IList<> , I have to display the number of TextBoxes separated by a comma in between. I have written an ItemsControl which iterates over the b...

Any substitute solutions of generic type attributes?

Becase we can't use generic type attributes, are there any substitute solutions? Maybe an example is helpful to discuss: public abstract class ErrorHandler { } public class AccessHandler : ErrorHandler { } public class ConnectionHandler : ErrorHandler { } public class OtherHandler : ErrorHandler { } public class CoHandler<T> : Attribut...

Can't see an assembly in add reference dialog box after installing it in gac

I have created a shared assemby MyLibray version 1.0.0.1 and installed it in gac. Again I created MyLibrary version 1.0.0.2 and installed it in gac. See the gac screen shot. But in Add Reference dialog box only older version 1.0.0.1 is available. See the screenshot. ...

How can i initialize some Dependency Injected instance?

Hi folks, I'm using StructureMap DI/IoC and I've got is a generic InMemory repository. Works great. I was wondering if it's possible to define the initial data which each repository holds, when it's requested? Now, the first reaction is to do this in the constructor of the class - but I'm using a Generic Repository .. so i don't know w...

view a docx file in C# .NET

I need to create C# .NET solution to view a .docx file directly from the database without writing on the hard disk. What would be the most feasible approach ? One option would be to convert the docx file to .mht format and save in the database as blob type. But I could not find a way to directly view it from the database. Another way ...

c#: controlling access to object from different threads

How do I control when a thread is permitted to access an object and when it is not. For example, if I have situation like below, I want to make sure that when I am doing something with objFoo in my ButtonClick event, I should not be able to touch objFoo from my doSomethingWithObjFoo method. private void button1_Click(object sender, Eve...

How to replace an exported part / object in a MEF container ?

I have a WPF app running, which needs all operations that affect the UI to be on the UI Thread. WPF also provides a Dispatcher class that handles this - so I extracted that into a dependency. public interface UIActionExecutor { void Do(Action action); } So in my production code, I use an exported implementation which d...

Convert a free text into an array of dates - Universal analysis matcher

Here's a big challenge... something not easy to do with clean code (though that's not really necessary). I have two strings, one a list of dates, one of times. The time can be on the first string. The format is unpredictable, but if it can meet the samples below, it would cover 90% of cases. Input date format is DD/MM public void Test(...

Custom provider with ADO .NET Entity Data Model and OData

Hi, I have two data provider services, they provide access to two different databases. These data services used XSD to generate the dataset objects and allow the user to perform the CRUD operation on the data. I want to use ADO .NET Entity framework and ODATA to define a common service which will interact with these two services (as re...

Find a files with wildcard

Hy, How to loop through files matching wildcard and find the file that was last date created. This is in VB ... So I have some files that are with a specific prefix and I like to find the one that is last datetime created! How can his be done? Thank you! Adrian ...

How to make wpf application as ole server

Hi, I would like to insert my wpf application in excel sheet just like an OLE object. Is it possible? If yes, how we can do this. In Excel 2003 when we click Insert->Object menu item, we get the 'Object' diloag. The 'Create New' tab of this dilaog contains varios OLE objects. I would like to display my DotNet exe application in this li...

Resizing controls added programatically - Compact Framework

I've googled this but can't find an answer. Controls added via the designer automatically scale depending on screen size, however controls added programatically don't. I've tried all sorts of combinations of anchor and dock but to no avail. Is this really a short coming in the compact framework? ...

Monitoring progress of PrintJob with callbacks

The MSDN documentation for PrintQueue.AddJob says that the xps overload provides 'progress notifications', but I don't see any kind of events or callbacks there. Is there anyway to have the printing thread call back and tell me when the job is done, or if there is an error. Or do I have to poll with a timer on the PrintQueue? ...

Formatting the Json serializarion in a .NET Web Service

Hi everybody, I have the following .NET web service with the following signature (IServices.cs): [OperationContract] [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)] string ReturnListOfPersons(); The implementation is (in the Services...

An embedded application for windows desktop using .NET platform?

I'm rebuilding an Embedded application: Prebuild application Specifications: Use : For dispaying the captured images/video from microscope image capturing device on windows based PC or Laptops. Sepcifications: Prebuild on .NET plateform using VC++ Flaws : Lacks some specified features. Current Requirement: Want to re...

Any tool similar to AribaWeb in .net?

Is there some tool similar to AribaWeb in .net? ...

MS UnitTest - Private Accesor not always recognized

This problem doesnt occur in all projects, hence it makes it even more frustrating. If I click on a Private method to create a unit test, it would generate a TestProject assembly and create a predefined class in there. It woudl also create a Accessor for that class. [TestMethod()] [DeploymentItem("xxx.Client.dll")] pub...

ThreadStatic vs. ThreadLocal<T> Performance

I recently read this post about poor performance of fields marked ThreadStatic - they're apparently 60x slower than normal field access. Does .NET 4's ThreadLocal< T > perform any better? Are there any alternatives that offer high performance thread-specific storage? ...

Prevent image scaling on GridViewColumn entires?

Hi, I have a GridViewColumn created with the following XAML: <GridViewColumn Header="Validated" > <GridViewColumn.CellTemplate> <DataTemplate> <Image Source="{Binding Path=Validated, Converter={StaticResource imageConverter}}" /> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> The images in the .png...