Unable to set a reference to System.Data.dll in a

2019-07-23 06:04发布

问题:

I created my first Silverlight application. In the client project, I want to define a Dataset object. To do so, I figured I first need to reference the System.Data namespace in the dll of the same name.

When I add a reference to the dll, I get a msg that "it was successfully added," I see thje dll in copied to the bin folder, and then it promptly removes the referenced dll from the bin folder.

Why?

回答1:

There is no Dataset class in the Silverlight SDK in fact there is no System.Data namespace for Silverlight.

Silverlight only has access to fraction of the features you would find in the full .NET framework. Certainly many of these older concepts such as the DataSet whilst still useful in some places are now being replaced with new approaches such as Entity Framework.

You should consider looking in to WCF RIA Services if you want to do some serious data work with Silverlight.