Exemplo n.º 1
0
 /// <summary>
 /// Selects all the projection fields directly from the index
 /// </summary>
 /// <typeparam name="TProjection">The type of the projection.</typeparam>
 public virtual IAsyncDocumentQuery <TProjection> SelectFields <TProjection>()
 {
     return(SelectFields <TProjection>(ReflectionUtil.GetPropertiesAndFieldsFor <TProjection>(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Select(x => x.Name).ToArray()));
 }
        private JObject ConvertEntityToJson(object entity, JObject metadata)
        {
            var entityType       = entity.GetType();
            var identityProperty = documentStore.Conventions.GetIdentityProperty(entityType);

            var objectAsJson = GetObjectAsJson(entity);

            if (identityProperty != null)
            {
                objectAsJson.Remove(identityProperty.Name);
            }
#if !SILVERLIGHT
            metadata[Raven.Abstractions.Data.Constants.RavenClrType] = JToken.FromObject(ReflectionUtil.GetFullNameWithoutVersionInformation(entityType));
#else
            metadata[Raven.Abstractions.Data.Constants.RavenClrType] = JToken.FromObject(entityType.AssemblyQualifiedName);
#endif
            var entityConverted = OnEntityConverted;
            if (entityConverted != null)
            {
                entityConverted(entity, objectAsJson, metadata);
            }

            return(objectAsJson);
        }