-3

this is the function I call

this.ExecuteSQLProcedure("sp_GenerateInterface", new object[] { TableName });

Result of above function and is stored in string variable

string tableInterface  = 

Public Class UserMaster
{
     Guid UserId { get; set; }
     string UserName { get; set; }
     Guid RoleId { get; set; }
     string FirstName { get; set; }
     string LastName { get; set; }
     Guid AddressId { get; set; }
     long ContactNumber { get; set; }
     string ProfilePicture { get; set; }
     bool? IsActive { get; set; }
     Guid? EntryBy { get; set; }
     DateTime? EntryDate { get; set; }
     Guid? UpdatedBy { get; set; }
     DateTime? UpdatedDate { get; set; }
     Guid? DeletedBy { get; set; }
     DateTime? DeletedDate { get; set; }
     string Email { get; set; }
     bool fnCheckContactNumberExists( long ContactNumber );
     bool fnCheckEmailExists( string Email );
     bool fnCheckUserExistsorNot( string LoginCredential );
     bool fnCheckUserNameAvailable( string UserName );
     bool fnCheckUserNameExists( string UserName );
     bool fnCheckUserStatus( string LoginCredntial );
     string fnGenerateFrenchiseNumber( );
     string fnGetFirstLastName( string LoginCredential );
     Guid fnGetUserId( string LoginCredential );
     void sp_AuthenticateLogin( string LoginCredential,  out string Message,  out string MessageType,  string Password );
     void sp_CreateUser( string City,  long ContactNumber,  string Email,  string FirstName,  string HouseNo,  string LandMark,  string Lane,  string LastName,  string LoginCredential,  out string Message,  out string MessageType,  string Password,  string Street,  string UserName );
}

Now I want to instantiate this Class so that I can use it anywhere

  • Welcome to [so], I think you can have a lot of result for instantiate an object from a string (like [this](https://stackoverflow.com/questions/1252371/initialize-a-class-by-string-variable-in-c) ). But instantiate an interface... maybe you should try to search the [so] and google, if still can't get your result, you can ask here again. – Prisoner Jul 21 '17 at 06:06
  • You mean the stored procedure returns the C# representation of interface and you want to use that interface? Am I getting it right? – Chetan Jul 21 '17 at 06:21
  • yes Chetan Ranpariya, My stored procedure returns the c# representation of Class and i want to use that class. First it was Interface so that i can implement or inherit an interface, now I converted to an Class – abhinav garg Aug 03 '17 at 19:54

1 Answers1

0

You can not initialize interface. You need to implement class from this interface.

class UserMaster : IUserMaster
 {
 //implementation of methods.
 }
what inmlements all the metods.

and you need to make converter, to be able assign values to this class. Be cause you want to have class with properties to equal with string?

raichiks
  • 286
  • 4
  • 16