I need to compare what's on my POCO
classes against my database.
I am currently using Microsoft Roslyn
and Microsoft.SqlServer.SMO
and comparing the data, in my opinion, 'roughly'. It's working perfectly, but I was wondering if there was a better way to do so.
Today I have to compile the file using Roslyn, load the database info and compare what I want.
Let's say I have this POCO
file:
[Table("XPTO", Schema="ASD")]
public class MyPoco
{
public int PropId {get; set;}
public virtual Prop Prop {get; set;}
public DateTime? MyDate {get; set;}
}
And I also have the Table info. I want to see if what is nullable in my POCO
class (MyDate) is nullable on my database and vice-versa. I want to see if my database has a Foreign Key
to table Props
and if it is not-nullable as in my POCO
.
As I said, it's already working today, I just wanted to rewrite the code to use a more effective way to even maintain.
Does EntityFramework provide some sort of API or anything?
System Info
SQL Server 2008 R2
Entity Framework 4.1
C# 4.0
Thanks();