MetaData Class Generator v0.1.0.0

by Frank Perez August 23, 2012

Since my first ASP.NET MVC, I've always used the Data Annotation Model Binder to perform simple validations like the following:

  • Range – validate whether the value of a property falls between a specified range of values.
  • Regular Expression – validate whether the value of a property matches a specified regular expression pattern.
  • Required – mark a property as required.
  • String Length – specify a maximum length for a string property.

The problem is that if you like to design "Database First" like me, it can take a significant amount of time to build all of the classes later. Since I'm the kind of person who hates tedious work, I created my own utility for building the classes called MetaData Class Generator. MetaData Class Generator is a console application for generating Data Annotation classes based on an existing SQL Server Database.

If you would like a copy of this application, you can download the latest version using the link below. The following is a list of important notes:

  • This application requires the Microsoft .NET Framework 4 Client Profile.
  • This application has only been tested with SQL Server 2008 R2. Other versions may work, but there could be issues mapping newer data types.
  • Be sure to read the README.TXT file for instructions on running the application.
  • I'd love to hear any feedback. What do you like, what do you not like, what kind of features would you like to see in future versions?


Links:
Download MetaData Class Generator http://pfsolutions-mi.com/Product/MetaDataClassGenerator
Using Data Annotations for Model Validation http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-6
Microsoft .NET Framework 4 Client Profile http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5765d7a8-7722-4888-a970-ac39b33fd8ab

Keywords:

Filed Under: .NET | MDG

Fluent Migrator Class Generator v0.1.0.0

by Frank Perez August 23, 2012

Earlier this year at the CodeMash conference in Sandusky, Ohio I heard about a NuGet Package called Fluent Migrator. Fluent Migrator is a database migration framework that uses classes for performing database migrations. Up until this point, the way I typically handled database migrations was to write T-SQL scripts or use a commercial application. So when I learned that I could accomplish database migrations using simple classes in .NET, I was intrigued.

The image above demonstrates how to use a Fluent Migrator class to perform a database migration (create table, create index, create foreign key, etc.). There are also similar expressions for deleting columns, altering tables, altering columns, and etc. I'm not going to go into all the details about how to use the framework. I think there is enough information on the project site to help anyone get started.

The one problem I found when using the Fluent Migrator framework is the barrier to getting started when the database already exists. Fluent Migrator does not have any kind of class generate utility that can build the initial class with all of the necessary create schema, table, column, and etc. commands. That means I would have to either use a T-SQL script of the current structure and then use Fluent Migrator classes for any future migrations. Or I could spend a significant amount of time building the initial class myself.

Since I'm the kind of person who hates monotonous work and thinking that I would want to use Fluent Migrator for several existing projects, I created my own utility for building the class called Fluent Migrator Class Generator. Fluent Migrator Class Generator is a console application for generating a Fluent Migrator class based on an existing SQL Server Database.

If you would like a copy of this application, you can download the latest version using the link below. The following is a list of important notes:

  • This application requires the Microsoft .NET Framework 4 Client Profile.
  • This application has only been tested with SQL Server 2008 R2. Other versions may work, but there could be issues mapping newer data types.
  • Be sure to read the README.TXT file for instructions on running the application.
  • I'd love to hear any feedback. What do you like, what do you not like, what kind of features would you like to see in future versions?


Links:
Download Fluent Migrator Class Generator http://pfsolutions-mi.com/Product/FluentMigratorClassGenerator
Fluent Migrator Project Site http://nuget.org/packages/FluentMigrator
Microsoft .NET Framework 4 Client Profile http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5765d7a8-7722-4888-a970-ac39b33fd8ab

Keywords:

Filed Under: .NET | FMG

DiscountASP.NET SQL Backup v1.4

by Frank Perez June 14, 2012

Earlier this week I received an email asking if the DSB (DiscountASP.NET SQL Backup) application could do secure FTP transfers. At first I assumed that an SSL certificate would be required, but I did some quick research on the DiscountASP Support Portal anyways. There I found a Knowledge Base Article showing that DiscountASP allows FTP over SSL on all IIS7 accounts.

Thinking this would be a great feature, I modified the DSB application to check for the Databases.XML file for a FtpEnableSsl setting. If the setting is “true”, a SSL connection is used for all FTP data and commands.

After some quick testing on two PCs, I sent the DSB v1.3 update. Later that evening I received an email thanking me for the change and quick response. It always feels good when someone appreciates your work.

The next day, I received an email from the same person stating they were having a problem restoring the backups. They had tried restoring a backup created with DSB v1.3 and an earlier release. In both tests, the restore in SQL Server failed with a "RESTORE FILELIST is terminating abnormally" error message.

As everyone should know, it is not a wise idea to backup a system and assume that the backups are good. It is important to periodically test the backups by restoring them. This was something I recall doing when I first created the DSB application. Unfortunately, I had not been repeating the restore test with every new release. So I grabbed my last SQL Server backup, attempted to perform a restore, and sighed when I got the exact same error.

After I got over the initial shock, I jumped right into the code and found the source of the problem. In the FTP Download process I was using the wrong class for writing the BAK file to the local disk. I fixed the code, and then retested the entire process (backup, download, and restore) on two different PCs with two different DiscountASP accounts. With everything working on my system, I sent the DSB v1.4 update to the user. The next day I received a response that the backup and restore process were now working on their system.

Moving forward, I will be sure to test the backup, download, and restore process with every new release. I will also be researching ideas for how I can notify users of important updates other than relying on this blog. I apologize for any problems this issue causes.


Links:
Download http://pfsolutions-mi.com/Product/DASPSQLBackup
DiscountASP.NET http://discountasp.net/
Enabling FTP over SSL in IIS7 https://support.discountasp.net/KB/a397/enabling-ftp-over-ssl-in-iis7.aspx

Keywords:

Filed Under: .NET | DSB

Website Monitor v1.0.0.0

by Frank Perez December 17, 2011

It has been more than 7 months since I released the first Website Monitor utility. Almost immediately after releasing the utility I had some ideas for improvement, but I wanted to wait until I received some feedback before working on a new version. Well, it's been long enough and I'm ready to release v1 with a few enhancements.

The first enhancement is an OnErrorCheckEverySeconds setting. This setting controls how often a website will be checked once an error occurs. For example, I might want to check a website every 10 minutes, but if an error occurs I want to check every minute.

The second enhancement is the ability to log each website check to a file. This enhancement was the most requested feature that I received. The logging feature is activated by entering a valid directory into the LogFolder setting. If the directory does not exist, the Website Monitor utility will try to create it. It goes without saying that the Website Monitor utility will need read, write, and delete rights to the directory.


The third and final enhancement is related to the second. It is the ability to automatically purge the old log files. If you don't want the Website Monitor to delete the logs, simply set the PurgeLogsAfterDays setting to zero.

If you would like a copy of this application, you can download the latest version from http://pfsolutions-mi.com/Product/WebsiteMonitor.

If you want to read all the blog posts on this topic http://pfsolutions-mi.com/blog/category/WSM.aspx

Keywords:

Filed Under: .NET | WSM

DiscountASP.NET SQL Backup v1.0.0.0

by Frank Perez December 4, 2011

It has been more than 6 months since I released the DiscountASP.NET SQL Backup utility. In that time I have received some good feedback and zero problems (excluding installation issues). Based on this, I'm ready to release v1 with a minor enhancement.

One of the most requested features I received was the ability to specify when the backup process is performed. By default, the DiscountASP.NET SQL Backup utility performs the Microsoft SQL Database Backup process at 12:00AM every day. Rather than trying to create my own scheduling system I decided to take advantage of the system that is already included in Windows - Task Scheduler.


Step 1: From the Actions menu, select the Create Basic Task... menu option.


Step 2: Name the task.


Step 3: Select when you want the task to start.


Step 4: Identify how often the task should be started.


Step 5: Select what action you want the task to perform.


Step 6: Enter the fullpath and filename of the DSB.Service.EXE file into the Program/script field. Be sure to include "-console" in the Add Arguments field. You will also need to include the fullpath in the Start in field.


Step 7: Click Finish.


If you would like a copy of this application, you can download the latest version from http://pfsolutions-mi.com/Product/DASPSQLBackup.

If you want to read all the blog posts on this topic http://pfsolutions-mi.com/blog/category/DSB.aspx


Links:
DiscountASP.NET http://discountasp.net/
DiscountASP.NET Control Panel API http://support.discountasp.net/KB/a176/control-panel-api.aspx
Microsoft .NET Framework 4 Client Profile http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5765d7a8-7722-4888-a970-ac39b33fd8ab

Keywords:

Filed Under: .NET | DSB

About Frank

Frank lives in West Bloomfield, Michigan with his wife and three children.  When he is not writing code, he enjoys long distance running and riding his motorcycle.

Month List

Tag Cloud