Software Architecture-Exception-Snapin project-Porting from .Net 3.5 to .Net 4.0

March 13, 2011

Exception:

Could not load file or assembly ‘XXXXX, Version=5.5.3484.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Environment:
There is a snapin project in solution. After porting solution from visual studio 2008/.Net 3.5 to visual studio 2010, the above exception is appearing.

Solution:
Add an environmental variable named COMPLUS_Version with value v4.0.30319 where v4.0.30319 is your version of .Net framework
This change will solve the above problem.


Protected: Software Architecture -To Study PCMS – Pegasus ERP Cargo Management System-Release-6 from Architecture perspective.

November 6, 2010

This content is password protected. To view it please enter your password below:


Protected: Software Architecture – Assemblies Abstractness vs. Instability for PCMS – Pegasus ERP Cargo Management System Release-6

November 6, 2010

This content is password protected. To view it please enter your password below:


Protected: Software Architecture – Assemblies Dependencies Diagram for PCMS – Pegasus ERP Cargo Management System Release-6

November 6, 2010

This content is password protected. To view it please enter your password below:


Software Architecture-Sliverlight 4.0-New Feature-FullScreenOptions property

September 28, 2010

Silverlight supports full screen mode. So there are 2 modes, one embedded mode and second full screen mode.
Full screen mode looks like as:

Embeded screen mode looks like as:

Full screen mode support was already there in previous versions of Silverlight. But in Sliverlight 4.0, we have a new feature by FullScreenOptions property.

Lets suppose a sample with following three radio button with xaml as:

First button code use IsFullScreen property to false (default value is false- So it can be avoided for embedded code mode) as:

private void radioButton1_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rdo = sender as RadioButton;
            if (rdo.IsChecked==true)
            {
                App.Current.Host.Content.IsFullScreen = false;
            }
        }

Second button code set the full screen mode to true. Secondly FullScreenOptions
is set to None-means that full screen mode will not be maintained when screen is not active.[It is default]

private void radioButton2_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rdo = sender as RadioButton;
            if (rdo.IsChecked == true)
            {
                App.Current.Host.Content.FullScreenOptions = System.Windows.Interop.FullScreenOptions.None; // default value-No need to specify.
                App.Current.Host.Content.IsFullScreen = true;
            }
        }

Thrid button code set full screen mode to true. Secondly, FullScreenOptions is set to StaysFullScreenWhenUnfocused means that full screen mode will be maintained when screen is not active.

private void radioButton3_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rdo = sender as RadioButton;
            if (rdo.IsChecked == true)
            {
                App.Current.Host.Content.FullScreenOptions = System.Windows.Interop.FullScreenOptions.StaysFullScreenWhenUnfocused;
                App.Current.Host.Content.IsFullScreen = true;
            }
        }

An option to save setting for FullScreenOptions is asked by silverlight as:

You can see the setting info by right clicking the Silverlight page as below:

Limitation of Full screen mode:
1. No Drag-and-drop support
2. No OpenFileDialog and SaveFileDialog dialog boxes support.
3. No Multitouch input support.
4. Most keyboard events are disabled.


Software Architecture-Silverlight 4-New Feature-Implicit Style

September 28, 2010

Silverlight 3 Style:
In Silverlight 3, style was supported as by specifying the Style property in the control.
One Style can be based on other Style as shown the code below.

<Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <Style x:Key="ButtonStyle" TargetType="Button">
                <Setter Property="Foreground" Value="Black" />
                <Setter Property="Background" Value="Red" />                
            </Style>
            <Style x:Key="NewButtonStyle" TargetType="Button" BasedOn="{StaticResource ButtonStyle}">
                <Setter Property="FontSize" Value="20" />
                <Setter Property="FontFamily" Value="Times New Roman"></Setter>
            </Style>

        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="500"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="100" ></RowDefinition>
            <RowDefinition Height="100" ></RowDefinition>
            <RowDefinition Height="100" ></RowDefinition>
        </Grid.RowDefinitions>
        <Button Name="btnClick" Grid.Column="0" Grid.Row="0" Width="300" Height="40" Content="Hello Sarwar" Style="{StaticResource ButtonStyle}" ></Button>
        <Button Name="btnClick2" Grid.Column="0" Grid.Row="1" Width="300" Height="40" Content="Hello Sarwar" Style="{StaticResource NewButtonStyle}" ></Button>
        <Button Name="btnClick3" Grid.Column="0" Grid.Row="2" Width="300" Height="40" Content="Hello Sarwar"></Button>
    </Grid>

So Output will be as:


First button is attached with style named “ButtonStyle”. Second button is attached with style named “NewButtonStyle” which is based on parent style named “ButtonStyle”.
Third button is not attached to any style, so it is with any style.

Sliverlight 4 Style:
With Silverlight 4, now we have implicit style feature which provide functionality to style control by specifying the TargetType property.

So Style for Button control can be defined as:

<Grid x:Name="LayoutRoot" Background="White">        
        <Grid.Resources>
            <Style TargetType="Button" >
                <Setter Property="Foreground" Value="Black" />
                <Setter Property="Background" Value="Red" />
                <Setter Property="FontSize" Value="15" />
                <Setter Property="FontFamily" Value="Times New Roman"></Setter>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="600"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="100" ></RowDefinition>
            <RowDefinition Height="100" ></RowDefinition>
            <RowDefinition Height="100" ></RowDefinition>
        </Grid.RowDefinitions>
        <Button Name="btnClick" Grid.Column="0" Grid.Row="1" Width="300" Height="40" Content="Hello Sarwar"></Button>
    </Grid>

It will apply to all the Buttons inside this Grid scope and will look like as:


If Style tag is added with x:Key=”MyStyle”, then implicit style feature will no longer work.

WPF was having this implicit style feature previously(Before WPF 4.0), but now Silverlight 4 also has this feature.


Software Architecture – Sync Data between offline/Disconnected databases – SSIS – BIDS

September 18, 2010

Problem definition:
ERP Product is installed in head office and 5 branch offices such that each location installation has its on database. Locations are not connected via Internet that is they are acting as diconnected databases.

We want to sync databases of different branches.

Solution:
Some possible solutions to problem are as:
• Replication
• ETL
• Sync Providors
• Sync Framework
• Change Data Capture
We will compare and analyze pros and corns of these method in separate post. But here we will use ETL approach to solve this problem.
At closing of each working day, data is fetched from each branch database and new data is posted to other branches and head office database Server via email. So each database read email and executes the database differences from other databases.
So we can break whole process in 4 programming Steps.
1. Extract data from source database and convert them into a text file with data/time stamp attached.
[Implemented as SSIS Package and run via C# Code]

For details see post here

2. Read files from a folder in step 1, and send them as attachment in email via Outlook.
[Implemented by interop of MS Outlook API]

For details see post here

3. On other side, emails are pulled automatically via outlook and attachments are downloaded and saved in a local folder in hard disk.
[Implemented by interop of MS Outlook API]
For details see post here

4. Text files s are read from folder and loaded in to database.
[Implemented as SSIS Package and run via C# Code]

For details see post here

Future consideration:

1. How to identify the differential of data between the daily move of data.
2. This solution is working for one table how to handle more tables for data sync process.
3. There are many hardcoded parameters that needs to be fetched from configuration files.

Source: download from here Rename the file to ssis-solution-toupload.zip to extract.
Feedback is welocme