Tuesday, May 24, 2016

SharePoint Foundation SKU removed!

As you may have recently read regarding the recent release of SharePoint 2016, the SharePoint Foundation SKU is no longer available with this new release!

This basically means that all current companies/organizations that use the SharePoint Foundation platform will not be able to upgrade to the same SKU in SharePoint 2016!  Therefore, the last version they can use of SharePoint Foundation will be SharePoint Foundation 2013.  This, of course, prevents them from using all of the new feature support available in SharePoint 2016 such as the larger database scalability improvements as well as a whole host of other features.

If you would like Microsoft to bring back the SharePoint Foundation SKU, then you can vote for this UserVoice item here: https://sharepoint.uservoice.com/forums/329220-sharepoint-dev-platform/suggestions/14128419-bring-back-the-sharepoint-foundation-sku

Thursday, May 19, 2016

Alternative to TopStyle Pro

I have been doing CSS editing for many, many years and my tool of choice in the past has always been TopStyle Pro.  However, I recently discovered that this product is being discontinued since it was purchased by the makers of CSE HTML Validator: https://www.htmlvalidator.com/topstyle/

Therefore, as soon as I discovered this, I began looking for alternatives and fortunately I did not have to look very far to find a very good alternative by Blumentals called Rapid CSS Editor: http://www.rapidcsseditor.com/

It looks very much like TopStyle Pro and has around the same cost as the earlier license of TopStyle Pro of around $39.95 ($29.95 for a Personal license)!


Microsoft Certification Booster Packs

In past years, Microsoft has offered "Second Shot" which allows you to attempt a failed Microsoft certification exam for FREE!  However, this year, Microsoft is offering "Booster Packs" which allows you to bundle practice tests or up to 4 retakes for a single Microsoft certification exam!

https://www.microsoft.com/en-us/learning/offers.aspx

But you need to hurry since these Booster Packs are only available for purchase until August 31, 2016!!

Wednesday, May 11, 2016

Re-generating an ADO.NET Entity Data Model from the database

I recently had to change my underlying database schema and therefore needed to update my Entity Framework Data Model.

Unfortunately, just updating the data model directly caused problems with column mappings, so I ended up having to regenerate the ADO.NET Entity Data Model.

Going through the Visual Studio Entity Data Model wizard went through just fine, however, because of the structure of the project/solution, I quickly discovered that I could not name my entity class the same name as before!

Instead, my class name was showing up as "Entities" instead of my original class name!

Well, thankfully, changing the name of the class was relatively easy by simply modifying the <EFModel>.Context.cs class file.



public partial class Entities: DbContext
{
        public Entities()
            : base("name=Entities")
        {
        }
}

I then simply changed this to match my Entities class name as follows:


public partial class MyCustomEntities: DbContext
{
        public MyCustomEntities()
            : base("name=MyCustomEntities")
        {
        }
}

Now I could work with my Entity Framework classes just as before!!

Entity Framework-Unable to load the specified metadata resource

I was working on updating my application with a newer version of Entity Framework when I suddenly encountered the following error message:


Based on a few discussion forum posts, there was a mention that the name of the .csdl, .ssdl and .msl files may have been incorrect/invalid in the Entity Framework connection string.

Well, based on looking at my connection string, I noticed that was indeed the case!

When I re-generated my Entity Framework Designer Model, I ended up changing the name of the underlying EDMX model file which consequently changed all of the names that are also required in the Entity Framework connection string.

Therefore, I had something like the following:

<add name="MyEntities" connectionString="metadata=res://*/OldModel.csdl|res://*/OldModel.ssdl|res://*/OldModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(local);initial catalog=MyCatalog;user id=sa;password=P@ssword!;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Since the EDMX model names were invalid, I had to change it to the following:


<add name="MyEntities" connectionString="metadata=res://*/NewModel.csdl|res://*/NewModel.ssdl|res://*/NewModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(local);initial catalog=MyCatalog;user id=sa;password=P@ssword!;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />

That was all that was needed to resolve my issue!

Upgrading Sitefinity Web Application Projects

While upgrading Sitefinity versions in general has gotten easier over time, one of the MAJOR problems developers still face today even with the latest releases of Sitefinity is upgrading Sitefinity Web Application projects (especially when they are under source control).

The reason this remains a problem is because all of the Sitefinity Web Application project references are referring to the bin directory of the project.

Therefore, when you use the Sitefinity Project Manager, it appropriately updates the assemblies in the bin folder for you.

However, all of the Project References in the Sitefinity Web Application C# project file still refer to older assembly versions!

The problem originates from the fact that the specific version numbers are directly hardcoded into the .csproj file.

So, when you compile the application with these outdated assembly version numbers, the Sitefinity Web Application continues to think that it needs a particular assembly version to execute at runtime, causing innumerable problems for developers to resolve.

For example, you may have a reference like the following in your .csproj file:


<Reference Include="Telerik.Sitefinity.Frontend, Version=1.3.350.0, Culture=neutral, PublicKeyToken=b28c218413bdf563, processorArchitecture=MSIL">
      <HintPath>packages\Telerik.Sitefinity.Feather.Core.1.3.350.0\lib\net45\Telerik.Sitefinity.Frontend.dll</HintPath>
      <Private>True</Private>
    </Reference>

Instead, you probably want to have something like the following in your .csproj file:


<Reference Include="Telerik.Sitefinity.Frontend">
      <HintPath>bin\Telerik.Sitefinity.Frontend.dll</HintPath>
      <Private>True</Private>
    </Reference>

This change eliminates the direct assembly version dependency in the .csproj file as you noticed earlier and makes upgrades much more flexible.

If you are using a framework such as Sitefinity Feather which has available NuGet packages, then you will also want to make sure that you verify which version of Sitefinity Feather is compatible with your particular version of Sitefinity:


The update shown above for Sitefinity Feather works with Sitefinity v. .9.0, but if you are using an OLDER version of Sitefinity (such as Sitefinity v. 8.2), then you will need to ensure that you are choosing an appropriate version of the Sitefinity Feather assemblies that is compatible with your particular version (which is relatively easy to accomplish in Visual Studio 2015):


Once you have worked through all those hurdles in your Sitefinity Web Application project, hopefully you should be able to build your project/solution and compile a properly upgraded Sitefinity Web Application project!

NOTE: DO NOT REBUILD, just BUILD, since a REBUILD may wipe out all of the assemblies in the Sitefinity bin directory!!

Good luck with your Sitefinity upgrades!!

Tuesday, May 10, 2016

Setting the default value on a SelectList in ASP.NET MVC

If you have ever encountered the issue whereby you needed to set a default value on a SelectList (for a dropdownlist control), then you might be wondering how to accomplish this!

For example, if you have a SelectList like the following:


List<SelectListItem> selectList = new List<SelectListItem>() { new SelectListItem() { Text = "IN", Value = "IN" }, new SelectListItem() { Text = "MI", Value = "MI" } };

Then you may want to set a default value for the SelectList as follows:


public List<SelectListItem> GetSelectedValueList(List<SelectListItem> selectList, string selectedValue)
        {
            List<SelectListItem> newSelectList = new List<SelectListItem>();
            foreach (var item in selectList)
            {
                var selectListItem = new SelectListItem() { Text = item.Text, Value = item.Value, Selected = false };

                //if the selected item matches
                if (item.Value.Equals(selectedValue))
                {
                    selectListItem.Selected = true;
                }//if

                newSelectList.Add(selectListItem);
            }//foreach

            return newSelectList;
        }

Now when you pass in an existing SelectList, you will get it populated with a default value like so:

model.State = GetSelectedValueList(selectList, "MI");

return View(model);

That is all there it to it!!

Thursday, May 5, 2016

Using Data Annotations in ASP.NET MVC Web Applications

If you use Data Annotations for your ASP.NET MVC Model or ViewModel classes, it is often difficult to remember exactly which Data Annotations are available to decorate your classes!

Well, fortunately, Microsoft has created an MSDN article covering many of the commonly available Data Annotations for use on your classes:


System.ComponentModel.DataAnnotations Namespace
https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations%28v=vs.110%29.aspx


DataType Enumeration https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.datatype%28v=vs.110%29.aspx