In my solution there are total three projects. Two of them is web application in ASP.Net MVC and one is C# class library. Both web applications use same DB so I created C# class library and put ADO.Net Entity Data Model(EDMX) in it. I added reference of C# class libray project in web applications and using ADO.Net Entity Data Model to access database. This working properly, I am able to access table, add/edit/delete records but issue comes when I am trying to write data annotations for validation. Class generated by EDMX in C# class library project for table is like this:
namespace EDMXProjectNamespace
{
using System;
using System.Collections.Generic;
public partial class DrugClass
{
public DrugClass()
{
this.Drugs = new HashSet<Drug>();
}
public int ID { get; set; }
public string Name { get; set; }
public string NName { get; set; }
public virtual ICollection<Drug> Drugs { get; set; }
}
}
For connection I added connection string generated in my C# class library project's App.config to Web.config so it's working fine. Now only issue is where to write data annotations for validating user input.
Thanks in advance....