Entity Framework and Using WCF Service

I get data where the database is hidden behind the WCF service. Can I use the Entity Framework in a scenario where I have custom objects coming from a web service? (No access to external database and no current plans for insert / update / delete logic)

Starting with an empty EF model and adding an object, I get this error when compiling: There is no mapping specified for EntitySet and AssociationSet instances in EntityContainer ..

Is it possible to make an object in this way and fill it with data received from the object? (In this case, WCF, but may also be predefined model class / xml data)

If the web service deleted the Customer object, I could do something like this using a dataset: Create an unrelated table and loop through the client properties, adding them to the temp line, add it with tbl_Customer.Addtbl_CustomerRow (customerRow) to get my view.

thanks nakori

+4
source share
1 answer

Objects are the object representations of your database records (see Object-Relationnal Mapping, ORM). Given Employee and SalesOrder, two hypothetical tables in the database:

Entity: Entities are instances of Entity types (e.g. Employee, SalesOrder), which are richly structured records with a key. Objects are grouped in Entity-Sets.

Adapted from the Modeling data in the Conceptual Abstraction Layer section: Entity Data Model Entity Framework ADO.NET Overview . It may also be good to read to start using EF.

As for comm via WCF, it is supported, so entities are fully serializable / deserializable. You may also know that you can create entities from an existing database, wizard, and thatโ€™s all.

+2
source

Source: https://habr.com/ru/post/1310633/


All Articles