SonghaySystem(::)

Songhay.NET: An Overview of the Songhay Namespace

CodePlex

The code archive for the Songhay Namespace is available at CodePlex.com in the Songhay System Data Access Framework.

SonghayThis document summarizes the design goals and designer intentions behind the Songhay namespace, written in C# for .NET 2.0.50727. The Songhay namespace is the ‘thin layer’ at the bottom of all Songhay System .NET application layers. The contents of this namespace attempts to not make the mistake of providing functionality that is already available in .NET. Rather, the Songhay namespace contains definitions that assert specific purpose over the general purpose of the .NET framework.

The specific purpose of the Songhay namespace is governed by these strong words:

The image of the Visual Studio 2005 project, shown at left, shows these strong words. Apart from Xml, the rest of this document discusses each of these words in turn. For Xml, do see “Songhay.NET: An Overview of the Songhay XML Namespace.”

The Songhay.Framework Static Class

Songhay.FrameworkThe strong word Framework in this static class indicates the .NET Framework. The assertion here is that the primal experience with .NET Framework is through a console—through the command line. The following table showing the member of this class reflects this assertion:

The Songhay.Framework Public Member

RunConsoleCommand() This member is merely a wrapper for CMD /C, based on code by S. Senthil Kumar. It returns a System.String.

The Songhay.FrameworkAssembly Static Class

Songhay.FrameworkAssemblyThese classes are concerned with extracting meta-data from what is called here a Framework Assembly, the *.DLL file containing complied .NET code. Originally, this was intended for populating the customary About… dialog box for Windows Forms applications. This proved to still be useful in spite of such a dialog box shipping with Visual Studio 2005.

The Songhay.FrameworkAssembly Public Member

GetAssemblyInfo()

Returns a string formatted with Environment.NewLine characters summarizing .NET assembly data.

It is a server-friendly wrapper for Songhay.AssemblyInfo (see below).

The Songhay.FrameworkAssemblyInfo Class

Songhay.FrameworkAssemblyInfoThis definition combines data from the Assembly.GetCustomAttributes Method and other members of the System.Reflection namespace. It was originally designed for use in Windows Forms applications but, through Songhay.FrameworkAssembly (see above), can be used in Server applications when reading “plain old objects” directly is not advantageous.

The Songhay.FrameworkAssemblyInfo Public Members

AssemblyTitle Attempts to return AssemblyTitleAttribute as a string. When this is null or empty, returns Assembly.CodeBase as a string.
AssemblyVersion Returns AssemblyName.Version as a string.
AssemblyVersionDetail Returns AssemblyName.Version.Major and AssemblyName.Version.Minor in a formatted string.
AssemblyDescription Attempts to return AssemblyDescriptionAttribute as a string. Failure returns String.Empty.
AssemblyProduct Attempts to return AssemblyProductAttribute as a string. Failure returns String.Empty.
AssemblyCopyright Attempts to return AssemblyCopyrightAttribute as a string. Failure returns String.Empty.
AssemblyCompany Attempts to return AssemblyCompanyAttribute as a string. Failure returns String.Empty.

The Songhay.FrameworkFile Static Class

Songhay.FrameworkFileThis defines helper routines providing disk file functionality not known to be available in the .NET in general and the System.IO namespace in particular.

The Songhay.FrameworkFile Public Members

FileName()

Returns the file name based on the specified path and System.IO.Path.DirectorySeparatorChar. You have the option of supplying your own directory separator character in an overload.

This member returns foo.txt from c:\myfolder\foo.txt.

PathRoot()

Returns the directory root based on the specified path and System.IO.Path.DirectorySeparatorChar. You have the option of supplying your own directory separator character in an overload.

This member returns c:\myfolder\ from c:\myfolder\foo.txt.

The Songhay.FrameworkType Static Class

Songhay.FrameworkTypeThis defines a response to the TryParse() methods for the new .NET 2.0 Nullable Types. This class definition also recognizes “Unix Time.”

The Songhay.FrameworkType Public Members

DateTimeFromUnixTime() Converts Unix time stamps to System.DateTime.
DateTimeToUnixTime() Converts the current time or a specified System.DateTime to a Unix time stamp.
ParseBoolean() Returns a Nullable Boolean based on the specified System.Object. Failure returns a Nullable with HasValue == false.
ParseByte() Returns a Nullable Byte based on the specified System.Object. Failure returns a Nullable with HasValue == false.
ParseDateTime() Returns a Nullable DateTime based on the specified System.Object. Failure returns a Nullable with HasValue == false.
ParseDateTimeWithFormat() Returns a System.String based on the specified System.Object and date-time format expression. Failure returns null.
ParseDouble() Returns a Nullable Double based on the specified System.Object. Failure returns a Nullable with HasValue == false.
ParseInt32() Returns a Nullable Int32 based on the specified System.Object. Failure returns a Nullable with HasValue == false.

The Songhay.Net.HttpVerb Static Class

Songhay.Net.HttpVerbThis definition recognizes the importance of REST for Windows “rich” clients—starting with Windows Forms. As of this writing, the HTTP verbs get and post are recognized here. Additionally, the concept of the XML post is implemented. This definition depends on the System.Net.HttpWebRequest class.

The Songhay.Net.HttpVerb Public Members

Get() Returns the result of an HTTP get in a System.String based on the specified resource location. You have the option of supplying proxy server information with a bypass switch.
Post() Returns the result of an HTTP post in a System.String based on the specified resource location and post data. You have the option of supplying proxy server information with a bypass switch.
XmlPost() Returns the result of an HTTP post in a System.String based on the specified resource location and post data. The post data is assumed to be an XML fragment. You have the option of supplying proxy server information with a bypass switch.

The Songhay.Xml Namespace

The Songhay.Xml namespace is overviewed in another document, “Songhay.NET: An Overview of the Songhay XML Namespace.”

Response to FxCop Analysis of this Namespace

As of this writing, the Songhay and Songhay.Net namespaces both ‘violate’ internationalization as indicated by the SpecifyIFormatProvider error. This is a typical, North American oversight that will be addressed in future!

The Songhay.Net namespace gets the AvoidNamespacesWithFewTypes error. Today, this error is considered an encouragement to develop the Songhay.Net namespace. For example, the case of using security credentials other than the default network credentials has yet to be implemented.

 
This document was last reviewed on Tuesday, May 01, 2007 at 03:57 PM PDT.
Copyright© 2008 by Bryan D. Wilhite All rights reserved. No part of this material may be used or reproduced in any form or by any means, or stored in a database or retrieval system, without prior written permission of the publisher except in the case of brief quotations embodied in critical articles and reviews. Making copies of any part of this material for any purpose other than your own personal use is a violation of United States copyright laws.

The information provided by Bryan D. Wilhite at kintespace.com is provided “as is” without warranty of any kind. In no event shall Bryan D. Wilhite or any of his affiliates be liable for any damages whatsoever including, but not limited to, direct, indirect, incidental, consequential, loss of business profits or special damages due to material published by Bryan D. Wilhite or any of his affiliates.