How to call a method in WPF application from a WCF Service hosted by the same WPF application? -



How to call a method in WPF application from a WCF Service hosted by the same WPF application? -

i've created wcf service hosted in wpf application. works. clients can access wcf service without issue.

now, when client phone call method in service, eg: setdata(mydataobject data), want method send "data" object wpf host processing.

how wire up???

my service hosted in wpf app:

host = new servicehost(typeof(wcftestservice.service1), new uri("http://localhost:8733/wcftestservice/")); // service host opened on ui thread host.addserviceendpoint(typeof(wcftestservice.iservice1), new basichttpbinding(), ""); // enable metadata exchange servicemetadatabehavior smb = new servicemetadatabehavior() { httpgetenabled = true }; host.description.behaviors.add(smb); // enable exeption details servicedebugbehavior sdb = host.description.behaviors.find<servicedebugbehavior>(); sdb.includeexceptiondetailinfaults = true; host.open();

my wcf service method:

public bool setdata(mydataobject data) { //how mydataobject wpf host??? // like: host.updatedata(data) <-- callback method??? homecoming true; }

i digressing question, there particular reason presentation layer , service layer coupled closely? think add together contents of mydataobject info transfer object create, or persist mydataobject (maybe temporarily) , have wpf application/host access through method phone call exposed same wcf service. way, info have provided.

wpf wcf

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -