English 中文(简体)
通过服务获取数据物体?
原标题:Exposing data object through a service?

我创建了一个SOAP服务,该服务本应通过分站式电解退回一个类物体和一个类孔。 问题是,我可以退还一份数据表,仅罚款,然而,从该处返回的物体在内部,而不是在我的DAL实体中具有积极的记录类型。

For example when I consume the service, I see SOAPService.Category, but not SOAPService.CategoryCollection (I should be able to see SOAPService.[all other data entities], 以及 the SOAPService.Category is of active record type, 以及 doesn t contain the actual Category properties.

这两门课程都是通过我的慢性DAL一代确定的。

 namespace TrainingWebService.DAL
 {
     /// <summary>
 // Strongly-typed collection for the Category class.
     /// </summary>
     [Serializable]
     public partial class CategoryCollection : ActiveList<Category, CategoryCollection>
     {  
     .
     .   
     .

以及

/// <summary>
/// This is an ActiveRecord class which wraps the Categories table.
/// </summary>
[Serializable]
public partial class Category : ActiveRecord<Category>, IActiveRecord
{
.
.
.    

培训网服务解决方案中有这些课程。

培训网服务。

using VRPCTrainingWebService.DAL;

namespace TrainingWebService { // VRPC Training Web Service - Interface [ServiceContract] public interface ISOAPService {

    [OperationContract]
    string GetDBConnectionStringDetails();

    [OperationContract]
    string ReturnSameString(string someString);


    //
    // Database-related
    //

    [OperationContract]                             // categories
    CategoryCollection GetAllCategories();          // SubSonic object

    [OperationContract]
    DataTable GetAllCategoriesAsDataTable();

    [OperationContract]
    DataTable GetCategoryAsDataTable(int id);

    [OperationContract]                             
    Category GetCategoryByID(int id);               // SubSonic object 

    [OperationContract]   
    // products
    ProductCollection GetAllProducts();

    [OperationContract]
    Product GetProductByID(int id);

    [OperationContract]                             // suppliers
    SupplierCollection GetAllSuppliers();

    [OperationContract]
    Supplier GetSupplierByID(int id);



iii

iii

In my SOAPservice.cs

 public CategoryCollection GetAllCategories()            // get a collection of all categories
    {
        return DataCaller.GetAllCategories();
    iii

    public DataTable GetAllCategoriesAsDataTable()
    {
        return DataCaller.GetCategoriesAsDataTable();
    iii

    public DataTable GetCategoryAsDataTable(int id)
    {
        return DataCaller.GetCategoryAsDataTable(id);
    iii


Here s a snip of the DataCaller code.

       /// <summary>
        /// Get all categories - returns a collection of categories
        /// </summary>
        /// <returns></returns>
        public static CategoryCollection GetAllCategories()
        {
            categoryCollection =
                DB.Select().From("Categories")
                    .ExecuteAsCollection<CategoryCollection>();

            return categoryCollection;
        iii


        public static DataTable GetCategoryAsDataTable(int id)
        {
            try
            {
                dtResults = new Select()
                                .Where(Category.Columns.CategoryID).IsEqualTo(id)
                                .From(Category.Schema)
                                .ExecuteAsCollection<CategoryCollection>().ToDataTable();
            iii
            catch (Exception ex)
            {
                throw ex;
            iii

            return dtResults;
        iii

我认为,这个问题可能在于通过我的网络服务揭露*.DAL实体,以便这些实体能够进入。

I have this working just fine in another solution I built a while back, but for some reason I can t see what I m missing here.

最佳回答

如果适用,请不要忘记与[DataContract]分离你的DAL常识。

数据栏:

问题回答

暂无回答




相关问题
WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...

Access WCF service on same server

I have a .NET website with a WCF service. How do I access the current operations context of my service? One possible work around is to just make a call to the service within the app...but that seems ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

The service operation requires a transaction to be flowed

I am facing strange issue with our WCF service. The same code was working fine until recently we added more OperationContracts(Web Methods). We have common 3 tier architecture. DAL (WCF) BLL Web ...

热门标签