Xamarin Forms 클라이언트와 .net 백엔드에서 Azure Mobile Apps를 사용하려고합니다. MikeCodesDotNet/App-Service-Helpers를 사용하여 클라이언트 측에서 시작하도록 돕고 있습니다. 첫 번째 엔티티는 간단한 게임 엔티티입니다.App Service 모바일 앱 - ''Backend.DataObjects.Game '유형에서'updatedAt '속성을 찾을 수 없습니다.'
클라이언트가로드되면 GET 요청이 게임을 가져 오지만 updatedAt가 사용되며 서버가 UpdatedAt를 원하는 것처럼 보입니다.
요청은 : http://192.168.0.105/Backend/tables/Game $ 필터 = (%의 20ge %의 updatedAt 20datetimeoffset % 271970-01-01T00 : 00 : 00.0000000 % 2B00 : 00 %, 27) & $ ORDERBY = updatedAt & $ 이동 = 0 & $ 위쪽 = 50 & __includeDeleted = 사실
{ $ ID와 실패
: "1", 메시지 : "은 URI에 지정된 쿼리가 유효하지 않습니다 'updatedAt'라는 이름의 속성을 찾을 수 없습니다. 유형 'Backend.DataObjects.Game'에35 ", exceptionMessage :" 'AthelinkBackend.DataObjects.Game'형식의 'updatedAt'속성을 찾을 수 없습니다. ", exceptionType :"Microsoft.Data.OData.ODataException ", stackTrace :"at Microsoft.Data .Data.OData.Query.MetadataBinder.Bind (QueryToken 토큰)에서 Microsoft.Data.OData.Query.EndPathBinder.BindEndPath (EndPathToken endPathToken, BindingState 상태)의 .OData.Query.EndPathBinder.GeneratePropertyAccessQueryForOpenType (EndPathToken endPathToken, SingleValueNode parentNode) Microsoft.Data.OData.Query.OrderByBinder.ProcessSingleOrderBy (BindingState 상태, OrderByClause thenBy, OrderByToken orderByToken)에서 Microsoft.Data.OData.Query.OrderByBinder.BindOrderBy (BindingState 상태, IEnumerable`1 orderByTokens) Microsoft.Data.OData. System.Web.Http.OData.Query.Order에서 Query.ODataUriParser.ParseOrderByImplementation (String orderBy, IEdmType elementType, IEdmEntitySet entitySet) ByQueryOption.get_OrderByClause() (System.Web.Http.OData.Query.Validators.OrderByQueryValidator.Validate (OrderByQueryOption orderByOption, ODataValidationSettings validationSettings) at System.Web.Http.OData.Query.OrderByQueryOption.Validate (ODataValidationSettings validationSettings) at System.Web. System.Web.Http.OData.EnableQueryAttribute.ValidateQuery에서 System.Web.Http.OData.Query.ODataQueryOptions.Validate (ODataValidationSettings validationSettings)의 .Http.OData.Query.Validators.ODataQueryValidator.Validate (ODataQueryOptions 옵션, ODataValidationSettings validationSettings) HttpRequestMessage System.Web.Http.OData.EnableQueryAttribute.OnActionExecuted에서 System.Web.Http.OData.EnableQueryAttribute.ExecuteQuery (개체 응답, HttpRequestMessage 요청 HttpActionDescriptor actionDescriptor)에서 요청 ODataQueryOptions queryOptions) (HttpActionExecutedContext actionExecutedContext) " }
,536,913 크롬의이지만 올바르게 완료된 GET 변수에서 UpdatedAt를 실행합니다.
이 문제를 해결하는 방법이나 클라이언트 문제 또는 서버 문제가있는 경우 어떻게해야할지 모르겠습니다. 클라이언트에
: 서버에
namespace GamesClient.Models
{
public class Game : AppServiceHelpers.Models.EntityData
{
public string Name { get; set; }
public string Type { get; set; }
}
}
:
namespace Backend.DataObjects
{
public class Game : EntityData
{
public string Name { get; set; }
public string Type { get; set; }
public virtual Collection<Participant> Participants { get; set; }
}
}
namespace Backend.Controllers
{
[AllowAnonymous]
public class GameController : TableController<Game>
{
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
MobileServiceContext context = new MobileServiceContext();
DomainManager = new EntityDomainManager<Game>(context, Request, Services);
}
// GET tables/Game
public IQueryable<Game> GetAllGame()
{
return Query();
}
// GET tables/Game/48D68C86-6EA6-4C25-AA33-223FC9A27959
public SingleResult<Game> GetGame(string id)
{
return Lookup(id);
}
// PATCH tables/Game/48D68C86-6EA6-4C25-AA33-223FC9A27959
public Task<Game> PatchGame(string id, Delta<Game> patch)
{
return UpdateAsync(id, patch);
}
// POST tables/Game
public async Task<IHttpActionResult> PostGame(Game item)
{
Game current = await InsertAsync(item);
return CreatedAtRoute("Tables", new { id = current.Id }, current);
}
// DELETE tables/Game/48D68C86-6EA6-4C25-AA33-223FC9A27959
public Task DeleteGame(string id)
{
return DeleteAsync(id);
}
}
}
업데이트 # 1
나는 데이터베이스를 확인하고 테이블이 제대로 생성되고있는 것 같습니다. 심지어 제대로 작동하는 Xamarin 클라이언트에서 POST/INSERT 할 수 있습니다.
Database tables and data in the Games table
은 정말 GET 요청에 필터에 UpdatedAt 및 updatedAt 총액 사이의 문제를 생각합니다.
(1) (어느 것이 updatedAt를 사용) 자 마린 클라이언트에서 얻을 :
$ 필터 = (updatedAt% 20ge %의 20datetimeoffset % 271970-01-01T00 : 00 : 00.0000000 % 2B00 : 00 %, 27) & $ ORDERBY = & $ updatedAt 이동 = 0 & $ 위쪽 =
(2)에서 얻을 크롬 (창이 상기 에러 메시지는 50 & __includeDeleted = TRUE
결과 NG UpdatedAt를 사용하라는 요청)
$ 필터 = (UpdatedAt퍼센트 20ge %의 20datetimeoffset % 271970-01-01T00 : 00 : 00.0000000 % 2B00 : 00 %, 27) & $ ORDERBY = UpdatedAt & 스킵 $ = 0 & $ 위로는 = 내 게임 쪽 서버에 올바른 응답
[
{
$id: "1",
id: "46d3db2c-c8d4-4a15-8724-d7ce95611a63",
type: "football ",
name: "game1"
},
{
$id: "2",
id: "02d02477-2618-4eda-90ad-34e4117ed423",
type: "basketball ",
name: "game2"
}
]
50 &이 __includeDeleted = 사실
결과는 Microsoft.WindowsAzure.Mobile.Service.Enti의 자식
그리고 클라이언트 측 tyData
는 게임 객체는 또한[Microsoft.WindowsAzure.MobileServices.UpdatedAt]
public DateTimeOffset UpdatedAt { get; set; }
, 제가 도움이 제공 할 수있는 로그 알고 감사 주시기 바랍니다 다음 UpdatedAt의 속성 정의와 EntityData 클래스의 아이입니다!
위의 내 문제에 대한 세부 정보를 추가했습니다. 또한 링크에 대해 감사드립니다. 서버 측 [odata filtering] (https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter3/dataconcepts/#filtering-data)의 예제가 updatedAt를 사용하고 있습니다. 소문자 'u'를 사용하면 내 문제가 심각하다는 것을 알게 될 것입니다.EntityData의 일부로 인해 해당 속성을 제어 할 수 없으므로 문제를 해결할 수있는 방법이 확실하지 않습니다. 로그 또는 기타 도움을 드릴 수있는 세부 정보가 있으면 알려주십시오. thanks – schnabs
AppServiceHelpers에 대한 github issue 목록에 쿼리를 추가 할 수 있습니다.이 SDK는 공식 Azure Mobile SDK가 아닌 SDK를 사용하므로 EntityData를 제공합니다. –
Visual Studio의 서버 쪽 템플릿이 올바르지 않습니다. 프로젝트 설정을 올바르게 부트 아웃 한 azure 포털에서 다운로드 가능한 퀵 스타트 서버 사이드 프로젝트를 시도해 보았습니다. 방금 모델을 새 프로젝트로 옮기고 컨트롤러를 비계하고 모든 것이 자동으로 예상대로 작동했습니다. 당신의 도움을 주셔서 감사합니다. – schnabs