locked
Creation of DTO object from Azure SDK 2.4 CreateQuery RRS feed

  • Question

  • HI,

    I looking generic approach for performing Server side project and resolve with Entity Resolve class Method. Does any1 has good example for converting Azure Table Instance (Object) to DTO object.

    For example to implement DTO object in Azure SDK 2.4 Table Storage. I saw some sample like Resolve(EntityAdapter.AdapterResolver> but looks like conversion happen on Client not on server side. Table Service pulls all the properties of an entity to client side and filers required properties @ client. I'm looking for generic approach where I get entity with only required properties from server side projections i.e send only required properties to client this will reduce load, since less payload.

    When i try to use TableQuery<DynamicTableEntity>().where (<Predicate>)

    where Predicate is expected in format FUNC<T,Bool> where T is of type DynamicTableEnitty. But i cant pass of type DynamicTableEntity,can we pass instead of DynamicTableEntity with ITableEntity .


    Mahender

    Thursday, October 16, 2014 11:23 PM

All replies

  • Hi,

    >>I'm looking for generic approach where I get entity with only required properties from server side projections

    As far as I know, If we want to get the entity with required properties, we could consider use SelectColumns Property, refer to http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.table.tablequery.selectcolumns.aspx for more details, the code below may give you some tips.

       TableQuery<CustomerEntity> tquery = new TableQuery<CustomerEntity>();
                    List<string> cloumns = new List<string>();
                    cloumns.Add("PhoneNumber");
                    tquery.SelectColumns = cloumns;
                    var result = cloudTable.ExecuteQuery(tquery);

    Best Regards,

    Jambor


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 17, 2014 6:57 AM
  • Thanks Jambor, I was using same approach, but the problem is I need to pass filter string in String format. Is there way to pass Expression<Func<T,bool>> predicate to filter string of TableQuery. I have re-write the predicate using

    TableQuery.GenerateFilterCondition

    Some time I receive NULL Reference Exception while calling

    public virtual void ReadEntity( IDictionary<stringEntityProperty> properties, OperationContext operationContext )
          {
              TableEntity.ReadUserObject(this.InnerObject, properties, operationContext);
          }


    Mahender

    Sunday, October 19, 2014 8:26 PM