Skip to main content

Microsoft Silverlight

Answered Question mac with entity frameworkRSS Feed

(0)

Bill Locke
Bill Locke

Member

Member

8 points

8 Posts

mac with entity framework

Not sure this is the place for this, but here goes.

I am having trouble getting a silverlight application to run on a mac. This application uses SL 2.0 and the entity framework and runs fine on a Windows machine.

On the mac, the application starts up fine and even accesses a custom WCF service on the server OK (for security).

At the point that I make the first request for data the program fails. If I use a relative Url it fails with an error about HtmlPage. (I didn't keep that exact error) This failure occurs in the LoadList function below.

With an absolute url it fails with the following error. "Internal error at 'ScriptXmlHttpRequest.CreateNativeRequest', this time on the EndExecute. In searching for this error the only reference I can find about it is calling the entity framework on a non-UI thread (doesn't work).

Does anybody have any information on this? Again, it works either way on Windows. I nailed down the exact spot of the failure by remote debugging the mac (pretty neat), but I've hit a brick wall here.

Thanks, Bill


public void LoadList()
{
string baseURI = Application.Current.Host.Source.AbsoluteUri.Substring(0, Application.Current.Host.Source.AbsoluteUri.LastIndexOf("ClientBin"));

Uri u = new Uri(baseURI + "CredentScreenDefinitionDataService.svc", UriKind.Absolute);
svcScreenContext = new CredentScreenDefinitionEntities(u);
svcScreenContext.BeginExecute(
new Uri(u.AbsoluteUri + "/view_InternetScreens?$orderby=GroupingName,Caption", UriKind.Absolute),
new AsyncCallback(OnScreenListLoadComplete),
svcScreenContext);
}

void OnScreenListLoadComplete(IAsyncResult result)
{
DataServiceContext dsListScreen = (DataServiceContext)result.AsyncState;
try
{
IEnumerable r = dsListScreen.EndExecute(result);
List screenListDefinition = r.ToList();
OnScreenListLoadComplete(new ScreenListLoadCompleteEventParms(screenListDefinition));
}
catch (Exception e)
{
MessageBox.Show(e.Message);
if (e.InnerException != null)
{
MessageBox.Show(e.InnerException.Message);
if (e.InnerException.InnerException != null)
MessageBox.Show(e.InnerException.InnerException.Message);
}
}
}
}

ken tucker
ken tucker

All-Star

All-Star

16322 points

2,492 Posts

Answered Question

Re: mac with entity framework

 I was wondering what fiddler shows is going on during the web service call. 

 

See Can I configure Fiddler to debug traffic from another machine (even a Mac or Unix box)? in this link

 

http://www.fiddler2.com/fiddler/help/hookup.asp#Q-NonWindows

Bill Locke
Bill Locke

Member

Member

8 points

8 Posts

Re: mac with entity framework

Thanks for the response Ken, I'll try getting that set up tomorrow and see what it tells me.

Bill Locke
Bill Locke

Member

Member

8 points

8 Posts

Re: mac with entity framework

I finally got back to this(other fires are mostly out). I set up fiddler and it produced no real insight, except for the fact that the request never leaves the building. The security service works OK, this is a hand coded WCF service. The code that I posted prviously never sends the request for the entity framework when on a mac. The basic fiddler information follows, exact same site, only difference is the mac or PC. I've confirmed that Safari on a PC works and that the latest mas OS makes no difference.

This is not a killer for us, but would really be nice if it worked. I would certainly look less like an idiot if it did.

 

For the mac it looks like the following:

POST http://---------/CredentSecurity.svc         
200 OK

(no further activity, dies on the screen list request) 

 

For the PC, a more normal access (images removed for brevity)

POST http://---------/CredentSecurity.svc
200 OK

GET http://---------/CredentScreenDefinitionDataService.svc/view_InternetScreens?$orderby=GroupingName,Caption
200 OK

GET http://---------/CredentScreenDefinitionDataService.svc/tblSLScreenDefinition?$filter=NameSpace%20eq%20'Symed'%20and%20ScreenName%20eq%20'PhysicianDetail'&$orderby=FieldID

GET http://---------/CredentScreenDefinitionDataService.svc/tblSLPropertyDefinition?$filter=NameSpace%20eq%20'Symed'%20and%20ScreenName%20eq%20'PhysicianDetail'&$orderby=FieldID
200 OK

GET http://---------/CredentDataService.svc/vwPhysicianDetail()?$filter=PhysicianID%20eq%201889%20&$orderby=
200 OK

GET http://---------/CredentDataService.svc/vwDegrees()?$filter=&$orderby=ShortName
200 OK

GET http://---------/CredentDataService.svc/vwMaritalStatus()?$filter=&$orderby=
200 OK

GET http://---------/CredentDataService.svc/vwStates()?$filter=&$orderby=LongName
200 OK

GET http://---------/CredentDataService.svc/vwtblStates()?$filter=&$orderby=LongName
200 OK

GET http://---------/CredentDataService.svc/vwtblStates()?$filter=&$orderby=LongName
200 OK

GET http://---------/CredentDataService.svc/vwtblStates()?$filter=&$orderby=LongName
200 OK

GET http://---------/CredentDataService.svc/vwGender()?$filter=&$orderby=
200 OK

GET http://---------/CredentDataService.svc/vwtblContactMethod()?$filter=&$orderby=ContactMethod
200 OK

POST http://---------/CredentSecurity.svc
200 OK

 

Bill Locke
Bill Locke

Member

Member

8 points

8 Posts

Re: mac with entity framework

I posted this message a while back and things have been pretty quiet about this subject. Since we have resolved this problem (in a manner of speaking) and moved on, I thought I would share our experiences.

We never could get the mac to work with the entity framework at all. It consistantly produced the errors described above. The one thing that we noticed was that the program was able to make it through our security request which was done with a standard WCF service. We have abandoned the Entity Framework in favor of our own custom DAL. Since we are using a WCF service, the mac now seems to be much happier about accessing the web site.

I must say that this was not the only factor considered in moving away from the Entity Framework, but just one of many factors that influenced our decision. Even though we delivered the site with the EF in the first couple of builds, we redid the backend before going live.

The Entity Framework seemed to be more of a hindrance than an enabling technology for us. There was thousands of lines of XML definitions for it that we constantly had to tweak. The stored proceduredures had to be wired up to this framework manually. It wouldn't use select stored procedures in combination with the Insert, Update and Delete stored procedures. It required delete stored procedures that had to pass every parameter used by the insert and update procedures. Since we couldn't use select stored procedures, we ended up having to use views, so we had to create those. There was thousands (in our case about 30,000) lines of code on the server AND the client side. We had to use T4 templates to massage the code on the client side. All this for about 30 input screens.

We are now using a custom DAL and dynamically creating the client side classes at run time. The server and the client code is static across all database access. We no longer need the thousands of lines of code, the special delete procedures, the views or the XML that comes along with the EF.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities