Posts
48
Comments
32
Trackbacks
0
April 2011 Entries
Enterprise Library 4.1 Fun!

I am working with a client to upgrade enterprise libraries in current code that they use. Specifically upgrading InfoPath 2003 Managed Code. Here are some things I learned while doing their upgrade:

1) Custom Sink = Custom Trace Listeners

      Enterprise library 1.1 or whatever the earlier version is has a Logging Block that allows you to create custom logging functionality. They were called Custom Sinks, well they are now called custom Trace Listeners in 4.1 and later. I can't say what 3.0 called them as I only started working with 4.1. This is not a huge deal except that the configuration documentation that was put together is not the same. Not only that but the old Custom Sink code overrides the following methods:

public override void Initialize(ConfigurationView configurationView)0

protected override void SendMessageCore(LogEntry logEntry){}

The new trace listener overrides the following:

public override void TraceData(System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object data)

public override void Write(string message) //along with several overloads

public override void WriteLine(string message) //along with several overloads

        If you are doing what I was doing, which was updating the Enterprise library to 4.1 or later then you will have issues with the new methods and inheriting class. You will have to inherit from "CustomTraceListener" and you can basically think of the old "Initialize" as the "Tracedata" method, and the old "SendMessageCore" as the Write and "Writeline", methods.

2) Attributes are Easier to Retrieve

      You might want to configure Attributes through the Configuration Files. The easiest process is to use the configuration tool that comes with the Enterprise libraries. The only reason I mention this is because I noticed a bunch of code in the old Custom Sink that seemed to retrieve the configuration information of the calling or using Application and get the Attributes. This is easier to retrieve than before. In the old "initialize" which is now , "TraceData", simply access the derived properties like so:

this.Attribibutes // this will give you an IDictionary<string, object> . All the configured attributes are there for you!

3) Inconsistent References will hurt you!

    I don't want to regurgitate what someone else already posted about but I used references in the GAC for the custom Trace Listener and then the calling application referenced the Signed assemblies or Unsigned assemblies somewhere else. Anyway, you will get errors like the following:

 "Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

Well this would appear that one of it's dependencies is not able to be loaded right? Well, maybe under the covers that's what is happening but the reason this happens is because you might be referencing different Enterprise library dll's. See this post for guidlines

Hope this helps someone!

Update: you might be asking why I didn't just use Enterprise Library 5.0? It is because Windows Server 2003 is not supported with the 5.0 version.

Posted On Monday, April 11, 2011 5:01 PM | Feedback (0)
Windows 7 or Windows Server 2008?

   I am in the proccess of putting together a demo machine. i arleady have a Windows 7 VM with the essentials for SharePoint Deveopment. But I spent some part of the weekend putting together a demo machine and after some thinking I decided to share some points that you might want to consider when putting together a Development or Demo machine as a SharePoint Developer\Consultant. I also welcome any comments and opinions or rebuttles to any of these points.

   I spent some time and put together a WIndows 7 Machine, with SQL Server 2008 R2, SharePoint Designer 2010, Visual Studio 2010, Office 2010, I was all set , untill....it came to installing SharePoint 2010. These are some of the things to consider when going Windows Server 2008 or Windows 7:

  •       Single Server vs Stand Alone - Stand Alone is one of the default install configurations as part of the SharePoint Installer. This installs SQL Express with SharePoint 2010. What I was really after is a Single Server environment. I want SQL Server 2008 R2 and SharePoint 2010 Installed, in one Server! If you want to install a Single Server environment you will need Domain Accounts for SharePoint Configuration. There are several really great posts that outline how you can get around this issue and install SharePoint on a Windows 7 machine while getting around this domain account issue.
  •        Domain Accounts - If you are trying to build a dev environment or a demo environment that you would like to simulate or replicate what a productionn environment then you might want to use Domain accounts. Most of my development in SharePoint 2007 was on a Windows Server environment that used default accounts and I faced so many issues with security. Ultimately Customizations that I developed in that environment didn't always work in production. This was a deal breaker for me in 2010! Ultimately you cannot make a windows 7 environment a domain control, or am I missing something?
  •        What is the major advantage to Use Windows 7 anyway? - This is an area that maybe others have great reasons why they would prefer Windows 7. Ultimately WIndows 7 is a desktop OS not a Server OS. It is great! I love my Windows 7! but utlimately I don't use my VM or demo machine as a desktop. I use it for SharePoint Development. One of the main concerns around using WIndows 7 (for me) is how bulky it would be. WIth all the software installed how much more resources will I need?
  •        You have to Install SharePoint Anyway! - If you haven not gotten down to developing in SharePoint 2010, you still need SharePoint installed , even on a WIndows 7 Machine! so now you add more bulk to your Desktop experience. Yes, maybe for some developers that are dabling with SharePoint Development this is a great option.  Usually I would add SharePoint Foundation and not the full blown version of SharePoint Server. Think of how bulky it would be to add the full blown SharePoint Server on a desktop OS??? Why would you ever want to do that? I need some help understanding where the advantage is here. I just don't see it.

Ultimately thse are the facts:

  • Windows 7 is not the Recommended OS in Production Environments. My point here is, I am going to try to simulate production as much as I can.
  • A Server will give you a Domain Control (Domain Accounts), Full blown SQL Server Installation that is supported, and a more realistic production configuration.
  • I will use SharePoint Server as a Development and a Demo Environment and not as a Desktop Experience.

 

    I should say that the only reason I can see why a developer would want SharePoint on Windows 7, is when you are a developer with Windows 7 already installed and most of your time is spent doing other development. It's a nice convience to be able to develop for SharePoint and just install some extras. The extras being...SharePoint Foudation and Sql Express, at the very least.

    These are just some of the reasons I can come up with. I have till now, been using VM Ware Fusion on my Macbook Pro and have installed SharePoint Foundation 2010 and developed with Visual Studio 2010 Ultimate. It has been great but I need SharePoint Server to run demos showcasing the full SP2010 features. It been great so far as a development VM but not necesarily as a demo or a Intense SharePoint Development Machine. 

    If you have reasons you like Windows 7 instead of Windows Server 2008 , please let me know. My mind can be swayed, but for now, I threw away my Windows 7 Machine that I spent this weekend building and re-building a SharePoint 2010 environment on Windows Server 2008. Looking forward to my new demo machine!

Juan

Posted On Monday, April 04, 2011 7:23 PM | Feedback (0)
Tag Cloud