Browse by Tags
All Tags »
DEV (
RSS)
In one of our projects, we encountered odd exceptions that were thrown out of “GetExportedValue<T>” from the CompositionContainer of MEF. There are 2 exceptions that I have seen that are related to the same issue: System.InvalidOperationException : GetExportedValue cannot be called before prerequisite import 'MyType..ctor(Parameter="myParameter", ContractName="MyOtherType")' has been set System.ArgumentException : An item with the same key has already been added...
There was a project that I assisted with the WCF communications where they needed to allow the client to specify different credentials without being dependent on the windows account. The first thing that comes into mind is to use the UserNameToken technique to pass in the client credentials. The design instructed to use TCP as the transport and not use message security. Obviously, this technique has privacy and integrity issues where there isn’t any encryption nor signing, but that was their decision...
As part of the task where I had to upgrade an existing WPF project to PRISM 4.0 and work with MEF, one of the requirements was to support registering existing non-attributed parts. Consider the following example - Code Snippet public interface IFoo { } public class Foo : IFoo { } static void Main( string [] args) { //This is the desired thing to do myCatalog.Register< IFoo , Foo >(); } As you can see, type Foo has no export definitions set on it. One approach would be to go over all the registrations...
Recently, I dug deep into MEF because I was involved in a project where there was a decision to upgrade the WPF client to PRISM 4 and advance to using MEF alone instead of Unity. While many argue that MEF isn’t yet a full DI framework, it still provides an easy way to enable application extensibility in your projects. One of the tasks that I had while upgrading the client to PRISM 4, is to keep supporting type registration in runtime, something in the sort of the following - Code Snippet public interface...
If you have a DateTime and you would like to get the localized name of the day according to the current culture, you can just do the following - myDateTime.ToString(“ddd”); I had a different scenario though, I had an object with a property of DayOfWeek enum which represents week days. I needed to display just that property in my UI as a localized string. In this case, I don’t have a DateTime so I can’t use its culture-based string formatting, so I can’t use the approach written above. I could obviously...
Update 26/09/2011 - There is an issue with the control where the entire tree is loaded, which may affect performance and memory allocation when working with many items. Unfortunately, I don’t think I would be able to fix that any time soon. A few years back, I built a WPF control that I decided to share here now. The control is called ComboView – A ComboBox showing a TreeView inside to display hierarchical data (you can use it for flat data if you need its features though). The control provides some...
One of the core components in WCF Contrib is the ‘ClientChannel’ which handles the client side proxy creation and management, allowing you to easily call services, with the addition of environment support, using using, and comprehensive behaviors extensions model. Currently, the built-in Client Channels can be instantiated with a configuration name which it loads the ChannelFactory with. A common question is, how can you use the Client Channel if you like to instantiate the ChannelFactory in code...
I’ve been reading about StreamInsight lately, there’s a lot of buzz around it nowadays. StreamInsight is mainly a data processing engine which has great performance and latency achievements, as well as massive throughput handling capabilities. It generally targets systems which need to handle events in massive concurrency or in cases where short latency is needed for resolving the information results. Let’s look at High Level Architecture - The architecture resembles BizTalk to say the truth, and...
In continuation of the previous posts - WPF – Editing Mode with Save and Cancel Capability WPF – Editing Mode with Save and Cancel Capability – Dynamic ViewModelProxy In this post I will demonstrate an elegant and simple solution that you can use regarding the second option presented in the first post series (cloning via serialization). The Use-Case Often, in more advanced scenarios, you need to duplicate your object for a different view. (read the first post for more detail) A commonly used technique...
Update 29/07: The project was updated, there was a minor bug in the object changed notifier. In continuation of a previous post - WPF – Editing Mode with Save and Cancel Capability In this post I will demonstrate an elegant and simple solution that you can utilize regarding the first option presented in the previous post. The Use-Case If you want to open an editable view over an existing read-only view with cancel capability, you usually wish you could use the same ViewModel instance as the DataContext...
A common scenario that is required by applications is the ability to show an entity in a view mode, and when the user wishes to edit that entity, another view is loaded in edit mode. In most cases, you would allow the user to save or cancel his changes. To illustrate the concept, consider the following interface - When a user clicks ‘Edit’: Usually, in a MVVM application, you would have a view model for each list item on the left screenshot. When the user clicks ‘Edit’ and the editable view is shown...
Update 29/07: The project was updated, there was a minor bug in the object changed notifier. A few years back I was looking for a good place to start with for building a nice feedback control. The purpose was to allow end-users to provide feedback on the application on any given subject. After browsing the internet, I found the following - Creating a 3D book-shaped application with speech and in using WPF 3.5 by Roberto Sonnino . It’s a very cool and a beautiful project, nice work Roberto! To make...
Make sure you visit WCF Contrib home . This release adds core optimizations and internal fixes to the infrastructure. There are no breaking changes from the last version, only internal improvements. In previous versions you may have encountered synchronization related errors such as recursive write/read locking. These issues were resolved and you should no longer experience that. This release is highly recommended over previous versions, make sure you use this one.
Update 29/07: The project was updated, there was a minor bug in the object changed notifier. Be sure to read the first post - Part One After showing the most basic in part 1, let’s see a real-life example of my finalized solution. I created a sample application which looks as follows - Let me go through this very quickly - The main view is bound to a MainViewModel. The employees list view at the left is bound an EmployeeListViewModel which is a member of the MainViewModel The employee details at...
Well, it has certainly been a while since I got to a good posting rhythm, I hope it changes soon because I have a series of posts in mind. This isn’t a post about general help and description for PRISM, MVVM, or DelegateCommand. There are many resources about these already. This post is to demonstrate how I managed to extend the DelegateCommand with some really cool features. The DelegateCommand that ships with CAL expects an “execute method” and a “can execute method” arguments in its constructor...
More Posts
Next page »