There is some code for an MVC application which was built using .NET 4.5 as a framework in VS 2012. My current system forces me to work on VS 2010. I managed to open the VS2012 solution in my VS2010, but the thing is that VS2010 supports only up to .NET 4.
There are a few functions in the code which use dll files which are available only for .NET 4.5, for example System.ComponentModel.DataAnnotations.Schema
.
So, are there any substitute functions/attributes which are available in .NET 4, which I could use to do the same that is being done on .NET 4.5 right now?
This is my current code using .NET 4.5:
[Table("UserProfile")]
public class UserProfile
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int UserId { get; set; }
public string UserName { get; set; }
}
As you can see DatabaseGeneratedAttribute
is available under the System.ComponentModel.DataAnnotations.Schema
namespace, which is a part of .NET 4.5.
Any suggestions on what the corresponding functions/attributes that could be used in .NET 4 to represent the same logic?
Note: In the code snippet given above, I get errors on Table
and DatabaseGeneratedAttribute
as
The type or namespace name 'Table' could not be found (are you missing a using directive or an assembly reference?)
and
The type or namespace name 'DatabaseGeneratedAttributeAttribute' could not be found (are you missing a using directive or an assembly reference?)
respectively. So, I am guessing that I just need to find the corresponding classes in NET 4.0 and things would fall into place. Your help is deeply appreciated.