[Route("find")][HttpGet]public IHttpActionResult FindPublic(string name){if (string.IsNullOrWhiteSpace(name) || name.Length <= 3)return Ok(new String[0]);var entities =Session.Query<Entity, Entities_DynamicGroup>().Where(x => x.IsClient).Where(x => x.Name.StartsWith(name)).Take(5).As<Entity>().ToList();return Ok(entities.Select(x => new { x.Name, Office = x.DefaultOffice, x.Id }).ToList());}
--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
class User {
string Id { get; set; }
string Name { get; set; }
}
{
{
Key: "Id",
Value: "users/348576"
},
{
Key: "Name",
Value: "Susie"
}
}
{
Id: "users/348576"
Name: "Susie"
}
class User {
string Id { get; set; }
string Name { get; set; }
}
{
{
Key: "Id",
Value: "users/348576"
},
{
Key: "Name",
Value: "Susie"
}
}
Oh. I assumed you were dealing with "document classes" that were annotated with json.net attributes.
In mose cases, I would expect the transformer result class to be the "view model".
return session.Query<Order>()
.TransformWith<OrderStatisticsTransformer, dynamic>()
.Where(x => x.CustomerId == "customers/1")
.ToList();
{
{
Key: "Id",
Value: "users/348576"
},
{
Key: "Name",
Value: "Susie"
}
}
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
using System;
using Raven.Imports.Newtonsoft.Json;
using Raven.Json.Linq;
public class RavenJObjectConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var json = ((RavenJObject)value).ToString(serializer.Formatting);
writer.WriteRawValue(json);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
{
return null;
}
// Load JObject from stream
var jObject = RavenJObject.Load(reader);
return jObject;
}
public override bool CanConvert(Type objectType)
{
return objectType == typeof(RavenJObject);
}
}
public class MyJsonResult : JsonResult
{
public override void ExecuteResult(ControllerContext context)
{
if (context == null)
{
throw new ArgumentNullException("context");
}
var response = context.HttpContext.Response;
if (!string.IsNullOrEmpty(ContentType))
{
response.ContentType = ContentType;
}
else
{
response.ContentType = "application/json";
}
if (ContentEncoding != null)
{
response.ContentEncoding = ContentEncoding;
}
if (Data != null)
{
var json = JsonConvert.SerializeObject(Data,
new Raven.Imports.Newtonsoft.Json.Converters.IsoDateTimeConverter(),
new RavenJObjectConverter());
response.Write(json);
}
}
}
public class Job
{
public string Id { get; set; }
public string Status { get; set; }
//... other properties ...
public RavenJObject Json { get; set; }
}
var job = JsonConvert.DeserializeObject<Job>(json, new RavenJObjectConverter());
No, they aren't
Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
, noone in their right mind should deploy via source (even if possible).
my 2 cents.
--
No, you would need the handle ravenjobject and ravenjarray, nothing else