The official Fatica Labs Blog! RSS 2.0
# Thursday, 03 November 2011

As we know the Caliburn Micro library implements a screen conductor to handle multiple screen models with only one active, typically used for tabbed views, that is easy to implement by deriving your model from Conductor<IScreen>.Collection.OneActive. This works out of the box with the standard tab control, but it is not possible to use it for example with the tabbed documents in AvalonDock. The only solution I found, that for some reason I will say below, is this one. I don’t like this solution because it force to write code inside the view, that is not acceptable in a pure MVVM solution, so I preferred to insulate the code in an attached behavior. In addition the presented solution will works correctly with the Activate/Deactivate/CanClose strategy on each document. We just need to modify the view markup as in the example below:

As you can see we just added an attached property UseConductor.DocumentConductor that we bind to the current model. Of course the model is a OneActive screen conductor. The behavior take care to connect the document items of the DocumentPane with the screen conductor items. If each screen implements IScreen, the proper Activate/Deactivate/CanClose are called, so we can even handle the case of canceling the close of a dirty document. Here the attached behavior code: An example MainModel can be the following one:

( we just add some random document to see how it behave )

And here below an example of a single screen  model:

So we have the conductor, without touching the view code, and without creating a custom screen conductor.

Thursday, 03 November 2011 19:52:59 (GMT Standard Time, UTC+00:00)  #    Comments [6] - Trackback
Caliburn | WPF | CodeProject

# Wednesday, 02 November 2011

Sometimes when we use mapping by code we want to see the generated HBM, just to understand if all is working as expected. I did this in some my old posts by dumping the hbm with an helper method, but I simply miss that the function exists as an extension method. Here below an example:

 var compiled = mapper.CompileMappingForAllExplicitlyAddedEntities();
#if DEBUG
            Trace.WriteLine(compiled.AsString());
#endif
            cfg.AddMapping(compiled);

 

We simply need to include the following using:

using NHibernate.Mapping.ByCode;

Here I use the AsString method that serialize in a string the compiled mapping.
Wednesday, 02 November 2011 14:39:29 (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
NH Mapping By Code | NHibernate

# Tuesday, 01 November 2011

In order to start with Azure we need to prepare our Visual Studio with the azure SDK. Even if the Windows Azure tools for Microsoft Visual Studio is only supported by Visual Studio 2010 & Visual Studio 2010 SP1 editions, you can download a standalone SDK providing low level tools, the API ( ie the client dll ) the documentation and the samples we need for start.

So the first step is downloading the Windows Azure SDK and install it. After the installation is complete you will see this in your Server Explorer:

image

So the new computer and barrels painted in azure means that we have the emulators for the compute service and storage locally running, this mean we can start to try something without buy a real account in the cloud with jus few differences. First time you expand the Storage a backend for it is created under SQL Express, but you can use another SQL server instance by following these instructions.

Another gift from Visual Studio Tools are the new application templates:

image

This is enough to get the environment ready on.

Tuesday, 01 November 2011 08:34:48 (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
azure | cloud

# Tuesday, 25 October 2011

I’m starting to learn something about cloud computing, probably with Azure: just because I’m a little .NET biased Smile 

image

What I like in the Cloud approach is the hardware availability – scalability. As a drawback we need even more broad band reliable collection, thinking on something like this, because the whole strategy fails if the end connection, the one with the user, fails or it is poor.

Now what we need is just a rocking idea to start…

Tuesday, 25 October 2011 14:24:18 (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
communication | technology

# Thursday, 20 October 2011

Since it is boring having to specify every time the Schema a table belongs to, it would be nice having a conventional strategy to automatically wire up this information. With NHibernate mapping by code functionality this is simple. The strategy I propose is having the last part of the entity namespace being equal with the schema. So for example we have an entity Product in the schema named Production we define the entity as:

MyEntities.Production.Product

Then by using a ConventionModelMapper we can write:

public class MyModelMapper:ConventionModelMapper
    {
        public MyModelMapper()
        {
            this.BeforeMapClass += (modelInspector, type, customizer) =>
                {
                    customizer.Schema(type.Namespace.Split('.').Last());
                };
        }
        
    }

And we achieve to write less line again :)

Thursday, 20 October 2011 12:05:18 (GMT Daylight Time, UTC+01:00)  #    Comments [1] - Trackback
NH Mapping By Code | NHibernate

# Tuesday, 11 October 2011

As I said in this post I' have been working on an helper library to encapsulate the extra work we should do in presenting big dataset to the user: limiting the resultset. I wrote a 5 minutes demo to show how the interface could appear reactive, based on NHibernate - Caliburn-and FlyFetch. This does not mean that Flyfetch depends on some way on these library, is just to have something to show very quickly. The present FlyFetch version is not bound to any presentation technology to ( even if RIA and WPF applications are probably the best candidates to use ).   The application requires to have AdventureWorks to so since the prerequisite are not trivial I decided to grab a little video of the sample app running, just to show the reactivity we can achieve with FlyFetch.

FlyFetch in a demo app

I managed to remove any proxy engine dependency ( I use an internal proxy factory to create a special custom proxy ), and I managed to have an MVVM friendly component since the pager works independently from the view.You are welcome to follow FlyFetch at this address, or simply fork your version here. As an update, I used flyfetch with success in production too :)

Tuesday, 11 October 2011 20:54:13 (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
CodeProject | FlyFetch | MVVM | WPF

My Stack Overflow
Contacts

Send mail to the author(s) E-mail

Tags
profile for Felice Pollano at Stack Overflow, Q&A for professional and enthusiast programmers
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2019
Felice Pollano
Sign In
Statistics
Total Posts: 157
This Year: 0
This Month: 0
This Week: 0
Comments: 127
This blog visits
All Content © 2019, Felice Pollano
DasBlog theme 'Business' created by Christoph De Baene (delarou) and modified by Felice Pollano
Nike Winkels Nederland Outlet Nike Nederland Store Outlet Nike Nederland 2015 Outlet Nike Outlet Online Nike Sneakers Outlet