Wednesday, February 26, 2014

Microsoft.SqlServer.Management.SMO

Hi All,

I’ve been using SMO heavily in my OSR data migration piece of work, and I’d like to share that with you.  To put SMO into context, I consider it as a programmatic way to interact with SSMS.
For CRUD actions, SqlClient is still very good. Very flexible compared to entity framework.
However, when we need extra flexibility, e.g., create/backup database, create/alter tables, especially running SQL with GO statement, SMO is the way to go.   

I’ve attached a Util class that demonstrates how it can be wrapped, and the dynamic SQL that gets generated by my program and executed via the Util class.

If you would like to know more, plenty of articles on MSND:
SQL Server Management Objects (SMO) is a collection of objects that are designed for programming all aspects of managing Microsoft SQL Server


Sqlserver nvarchar ntext difference

Thanks to Graeme for asking an interesting question about the difference between nvarchar and varchar. Since my first language can’t be stored in ACSII, I know nvarchar is the way to go.
Further reading on nvarchar(max) prompted us to think the differences between nvarchar and ntext, and we found the following in MSDN. 

ntext , text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead.

Don’t panic, further version doesn’t include SQLServer 2012.  Read more here:

.Net Entity Framework and DAL

This old post demonstrates some very interesting thoughts about DAL and Entity Framework, and discussed the design pattern (pros and cons) in an architecture point of view. At the last of this post, a ppt is embedded. http://www.wadewegner.com/2009/06/architecting-your-data-access-layer-with-the-entity-framework/
Here are some highlights and my understanding:
·         Use EF as DAL  This is still a good option to replace the CRUD. See my OpsLog comments below about EF.
·         Full Encapsulation of the Entity Framework.  This is the ideal solution but we probably won’t get to the complexity. It reduces coupling and make application testable.
·         Partial Encapsulation of the Entity Framework.  The author didn’t give an example, but I have some in EGMAN.  EGMAN uses MVC and MVVM (MVVM Model-View ViewModel is similar to MVC, Model-View Controller).  I used EF to map db to model (M in MVC), but sometimes lost the flexibility to add custom attribute and data access logic. I adopted MVVM, which use VM to replace C, and VM is the encapsulation of EF that extract data from the Model. 

Links of the month November

Links of the Month November

OpenXML: New and easiest way to do handle MS Office document on server (eg, mailmerge)
·         Example: TFS $ActewAGL.MailMerge
·         Download: http://www.microsoft.com/en-us/download/details.aspx?id=5124
·         Read More

Asp.NET MVC: A mindset change to build testable website
·         Office Website with very good tutorials
·         Sample website with 200+ pages of step by step guild on how to build the website, MVC Music Store
LINQ:  Jon Skeet re-implement LINQ in 45 posts. Download the ebook and learn.
Tools
·         Telerik Extensios for ASP.NET MVC: free open source controls for MVC. Every control come with full sample code and demo.
·         .Net Demon: Tool that build as you type
·         NCrunch similar to .Net Demon, but also do continuous testing.
·         Both tools Combine with LiveReload (and Chrome extension), No more F6 to build, and F5 to refresh
·         VS 2012 & TFS 2012 update 1 released.  Visual Studio 2012 Update 1 focuses on enhancements to SharePoint development, Windows development, continuous quality enablement, and tools for agile teams.
·         Together with update 1 release, MS also released VS2010 Application Lifecycle Management Virtual Machine and Hands-on-Labs.  It’s really time to upgrade!
Latest
·         I won’t tell you what this is, you so have to click to find out. http://www.microsoft.com/australia/ws2012xbox/
·         Announcing the Latest Release of Office Developer Tools
·         Video:  Bleeding edge ASP.NET: See what is next for MVC, Web API, SignalR and more…
·         Microsoft Releases SkyDrive SDKs for .NET, Windows Phone 8
·         HTML5 and Why Developers Need It (IE8 support 0% of its’ feature)
·       Finally: Windows (Phone/Tablet) 8 : Too many posts out there

scrum

     After three days of training on scrum, I'd like to share few tips and materials.
Scrum is simple to understand, hard to implement. It is the most popular agile methodology. Few things I like about it:

* Daily Scrum (also referred as daily stand-up, but what if Zhen broke his knee and can't stand):  is a good way to synchronise between team members. It is not a free form, and 3 questions are answered by every team member.  (was working, plan to work, any impediment)
* Retrospective: is the best part in my opinion. Every team member answer three questions, what went well, want went wrong, how to improve. The lecture said he used this to coach his kids soccer team :)

* Working in the order of priority, and deliver business value in each sprint.