there are 4-tier in my project

(1)WPF-UI(Presentation) (refrence of Service client)
(2) Service Client Class Library (Service Refrence of WCF Service)
(3) WCF Service (Refrence of Data Access)
(4) Class Library (Data Access)

All Details Are Inserted,Updated and deleted through Class Library in XML File query in Linq
But Problem is that
I Write this code in Data Access

public List<EmployeeManagementGridCollectionClass> GetData(List<EmployeeManagementGridCollectionClass> employees)
        {
            try
            {
               // var list = new Collection<EmployeeManagementGridCollectionClass>();

               // XDocument xmlDoc = XDocument.Load(ConfigurationManager.AppSettings["XmlFile"]);
                XDocument xmlDoc = XDocument.Load(filename);
               employees = (from x in xmlDoc.Descendants("Employee")
                             select new EmployeeManagementGridCollectionClass()
                            {
                                Id = x.Element("Id").Value,
                                Name = x.Element("Name").Value,
                                Age = int.Parse(x.Element("Age").Value),
                                Address = new EmployeeManagementGridCityState()
                                {
                                    City = x.Element("Address").Element("City").Value,
                                    State = x.Element("Address").Element("State").Value
                                }
                            }).ToList();
                //Read ListOf Employees
                foreach (var item in employees)
                {
                    EmployeeManagementGridCollectionClass empClass = new EmployeeManagementGridCollectionClass();
                    empClass.Id = item.Id;
                    empClass.Name = item.Name;
                    empClass.Age = item.Age;
                    empClass.City = item.City;
                    empClass.State = item.State;
                    emp.Add(empClass);
                }
                //return employee group to service
                return employees;
            }
            catch (Exception ex)
            {
                return null;
            }
        }

here i create a EmployeeManagementGridCollectionClass() also in access ..but return employee which is a list of employee which
i will Fetch in Presentation And Display that value in Grid..but problem is that how can i return this from service client class through presentation
bcoz there is no refrence through service client through access so i can make a list..how can i return value?

Recommended Answers

All 4 Replies

Are you saying your problem is that you don't have the type to reference in the client?

There are two ways of handling this-- if you just use the Employee item as a data transfer object between the data access layer and the service layer, then you should make another object that the service layer and the service client share as a data contract. Then, you turn the Employee object into that data contract object, and send it along.


If you don't want to do that, put the Employee class into its own project that can be referenced by all of the projects.

If you want to know how to return a list and not an array, it's in the configuration of the Service Reference. If you go to your list of Service References, then right click it and click Configure Service Reference, under the "Data Type" header you will see a drop down box next to "Collection Type". Set this to "System.Collections.Generic.List"

If this isn't what you're asking, I'm afraid you're going to have to clarify your question as I don't understand what you could be asking other than the above.

Thanks alc6379 -- i am new in WCf and i ave not much knowledge about that..but i make another object that the service layer and the service client share as a data contract.and it's successfully done...thanks

Is datatable(ado.net) included in windows phone programming?If yes how can i get that?If no ,instead of datatable what we can use in wpf?Please reply...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.