ITGoran blog

.NET, MEF, ASP .NET MVC, IoC, PowerShell, WCF, CSLA

By

CSLA 4, with support for .NET 4, Silverlight 4 and Visual Studio 2010 – released.

 

This is a major release of the CSLA .NET framework because of significant changes to CSLA itself based on feedback and input from the vibrant CSLA community.

You can download CSLA 4 here.

If this is you first contact with CSLA framework, you can read my previous post introduction to CSLA.

By

CSLA 4.0 Preview 4 available

CSLA framework 4.0 preview 4 available for download.

New framework 4.0 in general have break changes (here are some of them):
  – the new business and validation rules subsystem (this is covered in this post and here)
  – removed non-generic DataPortal methods.
  – CommandBase now implements IClonable, which means it works with automatic cloning when using a local data portal deployment. 
More on break changes you can read at Lhotka version 4.0.0 change log.
For highlights on CSLA 4 you can read here.

By

MIX10 Download Sessions – How to

 

In case You missed sessions in Mix10 you can use Mix10 Session Download to download all sessions. See details here.

By

ASP.NET MVC 2 RTM Released

 

ASP.NET MVC 2 provides a new Model-View-Controller (MVC) framework on top of the existing ASP.NET 3.5 SP1 runtime and can be downloaded from here.
Source code available from here.
ASP .NET MVC code examples are published at MSDN and can be downloaded from here.

By

CSLA .NET 3.8.2 released

 

Rockford Lhotka announces update to his CSLA application Framework.

This is a bug-fix release, and has been in beta for several months.

Can be downloaded here.

By

CSLA – Factory methods (part II)

 

This is continued from my first CSLA tutorial post (introduction)

In this post we will see some of the basic steps to create new CSLA object using factory methods.

Factory methods are method that we use to create new instance of the type.

If this method have same name like type (class), that method is called constructor.

In CSLA framework, default constructors are declared as private, so the users of the class

(usually developer) is "forced" to call factory methods to make new instance.

We can create new object using different criteria, in some scenarios we need to create new instance using simple types like string, int etc…, and in some we have to use complex type like Company, Salary etc… For that purpose, we can use SingleCriteria class or make our custom criteria class.

So, let’s see some different scenarios :

 

  1. 1. In our first example we will create declare type Employee with default create method.

 

 
#region using.statements 
using Csla;
using System;
#endregion
namespace CslaTutorial.FactoryMethods 
{  
   [Serializable]
   public class Employee : BusinessBase<Employee>
  {
       #region Factory Methods
       public static Employee CreateEmployee()
       {    
           return DataPortal.Fetch<Employee>();
       }
      
       protected override void DataPortal_Create()
      { 
         // Add some initialization here. 
      }
       private Employee() { }
       #endregion
   }  
}    

2. Factory method with use of criteria (SingleCriteria).
I prefer to use this criteria class when I don’t have 2 criteria with same type.
(ie. CreateEmployee(int id), CreateEmployee(int internalIdentificationNumber).

   #region using.statements 
    using Csla;
    using System; 
   #endregion

   namespace CslaTutorial.FactoryMethods 
   { 
      [Serializable]
     public class Employee : BusinessBase<Employee>
    {
            #region Factory Methods
            // Create Employee with SingleCritera (csla class). 
           public static Employee CreateEmployee(Company company) 
          {  
              return DataPortal.Create<Employee>(new SingleCriteria<Employee, Company>(company));    
           }
           
           private void DataPortal_Create(SingleCriteria<Employee, Company> criteria)
           { 
              // this method will be called when CreateEmployee(Company company) is called. 
            }
            
            private Employee() { }
           #endregion
     }   
}   

3. Factory method with custom criteria class EmployeeIdNumberCriteria.

#region using.statements

using Csla;
using System;
#endregion

namespace CslaTutorial.FactoryMethods
{
    [Serializable]
    public class Employee : BusinessBase<Employee>
    {

        #region Factory Methods

        // Create Employee with custom criteria.
        public static Employee CreateEmployeeWithCustomCriteria(string employIdNumber)
        {
            return DataPortal.Create<Employee>(new EmployeeIdNumberCriteria(employIdNumber));
        }

        private void DataPortal_Create(EmployeeIdNumberCriteria criteria)
        {
            // this method will be called by CSLA when method CreateEmployeeWithCustomCriteria(string employIdNumber) is called.
        }

       [Serializable]
        private class EmployeeIdNumberCriteria
        {
            public string EmployIdNumber { get; private set; }

            public EmployeeIdNumberCriteria(string employIdNumber)
            {
                EmployIdNumber = employIdNumber;
            }
        }

        private Employee()
        {   }

        #endregion

    }
}

So, those are basics steps to declare and define factory methods which will be called by CSLA framework.

By

Blogged – Greatest hits in 2009 by Scott Hanselman

If you missed all greatest blogs from Scott, it’s not too late to see some of the best here.

Great blogs Scott !!!

By

Microsoft® Visual Studio® 2010 and Team Foundation Server® 2010 Beta 2 virtual image for Windows Virtual PC

 

Microsoft Visual Studio 2010 Ultimate simplifies solution development, lowering risk and increasing return. The virtual machine image in this download contains both Microsoft Visual Studio 2010 Beta2 and Team Foundation Server 2010 Beta2 and is designed to be run under Windows Virtual PC.

Virtual PC files can be downloaded from here.

By

Happy New YEAR

 

Dear readers, I wish you happy New Year.

We see you next year with more posts.

 

Cheers.

By

ASP .NET MVC 2 RC released

 

ASP.NET MVC 2 is a framework for developing highly testable and maintainable Web applications by leveraging the Model-View-Controller (MVC) pattern. The framework encourages developers to maintain a clear separation of concerns among the responsibilities of the application – the UI logic using the view, user-input handling using the controller, and the domain logic using the model. ASP.NET MVC applications are easily testable using techniques such as test-driven development (TDD).

RC can be downloaded from here.