Screencast on Fluent NHibernate with Chad Myers

On August 21, I hosted a LiveMeeting event with Chad Myers to talk about Fluent NHibernate.  Fluent NHibernate is a API that eliminates the messy XML files.  It will create the mapping files and configuration file.

In this demo, Chad will convert the Nhibernate Made Simple project on Code Project to use the Fluent NHibernate. 

 

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Contributions I have made to the fluent-nhibernate API

In this post, I would like to outline the contribution I made to the fluent-nhibernate API open source project.  One of the features of the API is a fluent interface for creating the nhibernate configuration file for the ISessionFactory.  The ISessionFactory provides a few optional configuration properties.  An example of one these properties is  max_fetch_depth.

The max_fetch_depth property sets a maximum "depth" for the outer join fetch tree for single-ended associations (one-to-one, many-to-one).  A 0 disables default outer join fetching. 

After reviewing the way some of the other properties had already been set up.  I started with creating my first unit test to include this property.  Below is the unit test I created.

 

   1:  [Test]
   2:          public void Max_Fetch_Depth_should_set_property_value()
   3:          {
   4:              _config.MaxFetchDepth(2);
   5:              ValueOf("max_fetch_depth").ShouldEqual("2");
   6:          }

Then I implemented the following code for MaxFetchDepth.

   1:  public THIS MaxFetchDepth(int maxFetchDepth)
   2:          {
   3:              _values.Store(MaxFetchDepthKey, maxFetchDepth.ToString());
   4:              return (THIS)this;
   5:          }
 
This contribution was really easy to code, since I already had some other examples.  I was able to include all of the optional configuration properties with unit test.
 
Hopefully I will be able to add more contributions to the project.  As I do I will post to let everyone know.
 
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

New and Bigger Venue for #NWADNUG at The Jones Center

image I'm very excited to announce our new venue for our .Net user group meetings.  The staff at The Jones Center has allowed us to book the largest room at the Jones Center for the next 12 months.  This room is called the chapel and will seat about 337 people.  It also includes a very large projector screen.

We plan on hooking up our Live Meeting audio to the sound system.  This will allow us to host our meetings online. 

Now that we have a larger venue hopefully we can grow even bigger.

 

The purpose of the Northwest Arkansas .NET User Group is to:

· Promote the adoption of Microsoft .NET and related technologies.

· Educate members in Microsoft .NET and related technologies.

· Provide a direct channel of exchange of information between members.

· Create an environment for professional networking within Northwest Arkansas and the state-wide community.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

NWA AITP August 2008 Meeting Info

image For August 28, the Northwest Arkansas Association of IT Professionals group will be hosting Desiree Harbit with Robert Half Technologies.  Desiree will be presenting and answering questions about What Millennial Workers Want: How to Attract and Retain Gen Y Employees.

The next meeting is Thursday, August 28, 2008 at 6:00 pm at CEI Engineering at 3317 S.W. I St. in Bentonville. rsvp to : rsvp@nwa-aitp.org

Save the following future AITP meeting dates (rsvp to : rsvp@nwa-aitp.org) = Thursday, September 25, 2008 at 6:00 pm at Johnny Carino's (Rogers). Johnny Carino's is located at 535 N 46th Street in Rogers - Off 540 - Exit 85 (Walnut Street).

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tim Rayburn speaking on Parallelism in .NET at NWADNUG

Title: Parallelism in .NET : Doing more with more of less

Description: We stand at the edge of a new paradigm in computing, brought about by the evolution of multi-core CPUs.  Programmers have long left multi-threaded programming to the few diehards, while enterprise developers were able to live happily within a single thread.  Those times are changing, and the Parallel Extensions to the .NET Framework are here to help.  Come learn how Microsoft is innovating in this space, and how you can use this framework to bring your skills forward, after learning just a few simple rules.

Presenter: Tim Rayburn is a Principal Consultant with Sogeti USA, and a Microsoft MVP for Connected Systems Development.  He has worked with Microsoft technologies for over 13 years, and is the President and Founder of the Dallas Connected Systems User Group, the organizer of the Dallas TechFest, and blogger at TimRayburn.net.  When he’s not pursuing the ever moving technology curve, he is an avid gamer, from consoles to table-top RPGs and is the host of a podcast called Radio Free Hommlet.  He welcomes questions about any of the above to tim@timrayburn.net.

When:
Date
5:30 PM - 5:45 PM - Welcome and News, Sign-in and Food
5:45 PM - 6:00 PM - Lighting Presentation
6:00 PM - 6:10 PM - Intermission – Presenter switch over
6:10 PM – 7:30 PM – Main Presentation
7:30 PM – 8:00 PM – Closing and Prize give-a-ways

Where:
The Jones Center
922 East Emma Avenue
Springdale, AR 72764
Room 100

NetMeeting URL: http://snipr.com/3a542

Click here to RSVP on CodeZone!!!!!!!!!!!!


Calendar Links:

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Dennis J. Bottjer speaking about SharePoint Performance

We are a first class .Net User Group now!  The Jones Center has allowed us to reserve the largest room at the Jones Center.  Now we can hold 337 members with theater seating and a big screen.  Also we have hired the onsite caterer to provide meals each meeting.  So if you have been tired of eating pizza and have been wanting better seating we now have it.  Come join us this month and bring two friends.

You can also track us on twitter at http://www.hashtags.org/tag/nwadnug/

Click here to RSVP on CodeZone!!!!!!!!!!!!

Title: Tips for Improving SharePoint Performance

Description: A discussion for SharePoint Developers, Administrators and Solutions Architects focused on improving internet and intranet performance.  Tips will discuss a wide range of topics from adjusting out of the box settings to identifying memory leaks in custom code.  This discussion will benefit anyone currently design a SharePoint implementation!

Presenter: Dennis J. Bottjer is a Software Solutions Architect, for Microsoft Gold Partner SpringPoint Technologies, in Tulsa, OK.  He is a Microsoft ASP/ASP.NET MVP.  He previously worked for one of the largest US based Financial Services Companies on the FORTUNE 100.  He has an undergraduate degree in Management Information Systems from the University of Oklahoma.  Dennis served for two years as the President of the Jacksonville Developers User Group.

SWAG:
Inside Windows SharePoint Services 3.0 ($49.99)
Inside Office SharePoint Server ($44.99)
Professional Team Foundation Server ($39.99)
Hunting Security Bugs ($49.99)
JetBrains ReSharper ($199)
CodeSmith Studio ($99)
Infragistics NetAdvantage Suite ($999)
Windows Vista Ultimate ($319.99)

When:
September 2, 2008
5:30 PM - 5:45 PM - Welcome and News, Sign-in and Food
5:45 PM - 6:00 PM - Lighting Presentation
6:00 PM - 6:10 PM - Intermission – Presenter switch over
6:10 PM – 7:30 PM – Main Presentation
7:30 PM – 8:00 PM – Closing and Prize give-a-ways

Where:
The Jones Center
922 East Emma Avenue
Springdale, AR 72764
Room 100

NetMeeting URL: http://snipr.com/3a50w

Click here to RSVP on CodeZone!!!!!!!!!!!!

Add to your calendar

 

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Does the Fluent NHibernate create static XML mapping files?

This was one of the first questions I had when I started learning about the Fluent Nhibernate API.  In this article, I want to explain why the  API does not need to create static XML files.  This API can create static XML files, but it is not necessary.  If you have not already read Skinning the Cat with Fluent NHibernate by Bobby Johnson I would start there first. 

When using just NHibernate you can configure the ISessionFactory in several ways.  The following code is one way to configure the ISessionFactory instance.

   1:  ISessionFactory sessionFactory =
   2:        new Configuration().Configure().BuildSessionFactory();

This approach takes a full configuration file called hibernate.cfg.xml and builds the entire sessionFactory in one complete pass.  Within this configuration file is the locations of the mapping files.  During the creation of the instance the mapping files are parsed and loaded into the instance. 

The following XML is a sample hibernate.cfg.xml file.  Notice the mapping tags at the bottom.

   1:  <?xml version='1.0' encoding='utf-8'?>
   2:  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
   3:      <!-- an ISessionFactory instance -->
   4:      <session-factory>
   5:          <!-- properties -->
   6:          <property name="connection.provider">NHibernate.
   7:                    Connection.DriverConnectionProvider</property>
   8:          <property name="connection.driver_class">NHibernate.
   9:                    Driver.SqlClientDriver</property>
  10:          <property name="connection.connection_string">Server=
  11:                    localhost;initial catalog=nhibernate;
  12:                    User Id=;Password=</property>
  13:          <property name="show_sql">false</property>
  14:          <property name="dialect">NHibernate.
  15:                    Dialect.MsSql2000Dialect</property>
  16:          <property name="use_outer_join">true</property>
  17:          <!-- mapping files -->
  18:          <mapping resource="NHibernate.Auction.Item.hbm.xml" 
  19:                           assembly="NHibernate.Auction" />
  20:          <mapping resource="NHibernate.Auction.Bid.hbm.xml" 
  21:                           assembly="NHibernate.Auction" />
  22:      </session-factory>
  23:  </hibernate-configuration>

With the Fluent NHibernate API, this process is handled differently.  The addMappingsFromAssembly() method in the PersistenceModel class of the API will use reflection to loop through all the types in the assembly, and see if any of them implement IMapping (ClassMap<T> implements IMapping). Next the types that are identified will be converted to in-memory XmlDocument objects.  These objects will then be passed into the configuration instead of the static XML mapping files.  Nhibernate has always supported XmlDocument.  The below code shows how the configuration is done with the Fluent NHibernate API. 

   1:  var cfg = new Configuration().Configure();
   2:   
   3:  var persistenceModel = new PersistenceModel(); 
   4:  persistenceModel.addMappingsFromAssembly
          (Assembly.Load("Your DAL Assembly")); 
   5:  persistenceModel.Configure(cfg); 
   6:   
   7:  ISessionFactory sessionFactory = cfg.BuildSessionFactory();

In my next post, I will explain how the Fluent NHibernate API can be used for testing the ClassMaps.

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Jeffrey Palermo speaking to NWADNUG

This will be our first INETA speaker for the year.  If you are an agile developer this will be a great presentation to see.  Jeff is known throughout the agile community and country for his involvement in ALT.NET.  Please come out and join us and learn more about agile development.

Jeffrey Palermo is a software management consultant and the CTO of Headspring Systems in Austin, TX. Jeffrey specializes in Agile coaching and helps companies double the productivity of software teams. Jeffrey is an MCSD.Net , Microsoft MVP, Certified Scrummaster, Austin .Net User Group leader, AgileAustin board member, INETA speaker, INETA Membership Mentor, Christian, husband, father, motorcyclist, Eagle Scout, U.S. Army Veteran, and Texas A&M University graduate.

Spelled out, it is test-driven development, dependency injection, and separation of concerns with Active Server Pages .Net Model View Controller.  This talk will dive into how to design a presentation layer using ASP.NET MVC.  In today's industry, TDD, DI, and SoC are proven concepts that lead to more maintainable applications.  Along with demonstrating how to use these techniques with ASP.NET MVC, we will discuss just what concerns should be separated.  This talk provides a unique perspective on separation of concerns and uses TDD and DI to make it happen.  MvcContrib is used in all the demos.

 

Subscribe to Jeffrey's blog feed here:  http://feeds.jeffreypalermo.com/jeffreypalermo

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Daily Standup Meetings for Agile Instructional Designers

 

In this post, I will introduce the concept of daily standup meetings for instructional designers .  A lot has been written on this topic for agile software development.  But this agile principle can be used in any field like instructional design.  Therefore, this blog will explain the benefits, key questions and structure of a daily standup meeting.

A lot of benefits come to my mind when I start thinking about daily standup meetings.  One of the most important benefits is communication within a team.  Without communication, agility is impossible.  Conducting standup meetings provides a way for communication to happen on a daily basis.

Without this communication occurring daily, the team could be in the dark.  For example, if the direction is changing and not communicated, then the team could be running in circles.  By providing statuses, the team members know what the direction is on a daily basis.  Knowing the direction, you can set your focus and priorities on your particular tasks.  What keeps this meeting from being micro-managed is that the manager only listens and writes down issues that need to be resolved.  Also the manager helps by keeping the meeting focused.

Also another important benefit of these meetings is shared commitment.  One of the questions that is asked during this meeting, is what you are committed to working on that day.  Because the next day you'll explain what you accomplished the previous day.  The discussions that are held at these meetings are really about commitments and obstacles.  The purpose of the meeting is not to solve problems. 

Team building is another benefit of having these standup meetings.  Effective teams are always communicating and can easily overcome obstacles.  Another question that is asked during these meetings is current obstacles.  Communicating these obstacles on a daily basis to the team provides everyone the history of the obstacles.  Also these obstacles can be heard by all team members and can be brought to everyone's attention.  You never know when someone else has struggled with the same obstacle.

Now let's talk about how to keep the meetings focused.  The best way to keep the meetings focused is by asking three key questions.  These questions are What did I do yesterday? What am I doing today? and What are the obstacles that I have to keep me from doing what I need to do today?  In the article, It's Not Just Standing Up: Patterns of Daily Stand-up Meetings Martin Fowler rephrases these questions to the following Was I able to fulfill what I committed to? What am I comfortable committing to today? and What is obstructing me in meeting my commitments? As I have already explained, the first two questions focus on commitment and the last focuses on obstacles.  Each team member should only take about two minutes answering these questions for the team.  The precaution is to focus the three question and not to trying to solve problems.  Problems that do need to be resolved need to be handled in a different meeting.

Lastly, I want to discuss the structure of the meeting.  Below is a list of recommendations that I found during my research.

  1. Meeting should only last about 15 minutes.
  2. For smaller teams, meeting every other day may be more effective.
  3. Answers to the questions should not be detailed, but should be a happy medium of not enough details and too much detail.
  4. The meetings are always held at the same place and same time.
  5. If the meetings are not being effective, then change it and try something different.  The meetings should always be a state continuous improvement.  These meetings should provide a very supportive feeling for the team.
  6. Anybody that is committed or involved in the project can attend but only the committed members can talk.  Someone who is only involved, and who wants to discuss something outside the scope of this meeting, should set up something outside of this meeting.
  7. If someone cannot make the meetings they can attend by proxy.  This could mean that they send in their status via e-mail or attend via a conference call. 

You can read more about the standup meetings by starting to look at what I tagged on delicious.  http://delicious.com/zachariahyoung/standup

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

fluent-nhibernate for creating entity mapping files

fluent-nhibernate is an API that creates nhibernate entity mapping files.  This will prevent you from having to create the XML mapping files and provides testability.  This API was part of the Shade Tree code base written by Jeremy Miller. 

To understand how to use this API you need to understand fluent interfaces.  This pattern is typically used for constructing complex objects.  Typically these complex objects are used when building XML or text files.  When building these complex objects you may be provided with lots of different options.  So instead of using a constructor, the object is constructed by what appears to be method chaining.  After each method has been called the object returns a reference to itself for the next method to call.  Using this pattern makes the coding more fluent and simpler to read.  Let's review a few lines of code to illustrate this concept.  One of the examples that I was provided was from Chad Myers.  His example is a “Lorem Ipsum” filler text generator. (http://lipsum.org).

This sample could be a typical object construction.

   1:  var generator = new LipsumGenerator();
   2:  generator.UnitType = UnitType.Pargraph;
   3:  generator.NumberOfUnits = 5;
   4:  generator.StartWithLorem = true;
   5:  generator.ColumnWidth = 76;
   6:  var text = generator.Generate();
 
But if you're using a fluent interface API. It might look like this.
   1:  var text = new LipsumGenerator()
   2:                       .Number OfParagraphs(5)
   3:                       .StartingWithLorem()
   4:                       .WithColumnWidth(76)
   5:                       .Generate();
 
 With fluent-nhibernate your code would look like following.
   1:  public CustomerMap : ClassMap<Customer>
   2:  {
   3:    public CustomerMap()
   4:    {
   5:      UseIdentityForKey(x => x.ID);
   6:      Map(x => x.Name);
   7:      Map(x => x.Credit);
   8:      HasMany<Product>(x => x.Products)
   9:        .AsBag();
  10:      Component<Address>(x => x.Address, m =>  
  11:      {  
  12:          m.Map(x => x.AddressLine1);  
  13:          m.Map(x => x.AddressLine2);  
  14:          m.Map(x => x.CityName);  
  15:          m.Map(x => x.CountryName);  
  16:      });
  17:  }
 

The following entity mapping file would be created.

   1:  <?xml version="1.0" encoding="utf-8" ?>
   2:  <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
   3:      namespace="Eg" assembly="Eg">
   4:      <class name="Customer" table="Customers">
   5:          <id name="ID">
   6:              <generator class="identity" />
   7:          </id>
   8:          <property name="Name" />
   9:          <property name="Credit" />
  10:          <bag name="Products" table="Products">
  11:              <key column="CustomerID"/>
  12:              <one-to-many class="Eg.Product, Eg"/>
  13:          </bag>
  14:          <component name="Address" class="Eg.Address, Eg">
  15:              <property name="AddressLine1" />
  16:              <property name="AddressLine2" />
  17:              <property name="CityName" />
  18:              <property name="CountryName" />
  19:          </component>
  20:      </class>
  21:  </hibernate-mapping>

My links of fluent interfaces tagged on delicious.

http://delicious.com/zachariahyoung/fluentinterface

 

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

About Me

I'm a technologist living in Springdale, AR. My passion is learning and using technology from around the world.

Blog Twitter Flickr del.icio.us
TwitterCounter for @zachariahyoung

Flickr

Recent comments