I am working on MVC 4 and WCF Class Library I had added method that is return List<class> and I have added reference of WCF services.
now I am creating proxy of ServiceReference1 then I am not able to get this ServiceReference1 object.
if I changed return type to string then it working..
I had tried changing all collection type but I dint get ServiceReference1 object.!
where I am wrong or what is the solution.?
My WCF code is here
public class BuildTrackerService : IBuildTrackerService
{
public List<property> DoWork()
{
DataTable dt = new DataTable();
List<property> objProperty = new List<property>();
SqlConnection conn = DbConnection.GetConnection();
SqlDataAdapter adpt = new SqlDataAdapter("[GetPropertyDetail]", conn);
adpt.SelectCommand.CommandType = CommandType.StoredProcedure;
try
{
conn.Open();
adpt.Fill(dt);
}
catch (Exception) { throw; }
finally
{
conn.Close();
adpt.Dispose();
}
objProperty = DataTableHelper.ConvertTo<property>(dt);
return objProperty;
}
}
MY MVC 4 ActionResult is like
public ActionResult Index()
{
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
//==> this ServiceReference1 is not accessible here....!ServiceReference1.BuildTrackerServiceClient obj = new ServiceReference1.BuildTrackerServiceClient();
var objct = obj.DoWork();
return View();
}
I had tried with !
[1]:
http://i.stack.imgur.com/yQYyv.png