Raven.Client.Document.DocumentConvention.GetIdentityProperty C# (CSharp) Method

GetIdentityProperty() public method

public GetIdentityProperty ( Type type ) : PropertyInfo
type System.Type
return System.Reflection.PropertyInfo
		public PropertyInfo GetIdentityProperty(Type type)
		{
			return type.GetProperties().FirstOrDefault(FindIdentityProperty);
		}

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Selects the projection fields directly from the index
        /// </summary>
        /// <typeparam name="TProjection">The type of the projection.</typeparam>
        public IDocumentQuery <TProjection> SelectFields <TProjection>()
        {
            var propertyInfos    = typeof(TProjection).GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            var projections      = propertyInfos.Select(x => x.Name).ToArray();
            var identityProperty = DocumentConvention.GetIdentityProperty(typeof(TProjection));
            var fields           = propertyInfos.Select(p => (p == identityProperty) ? Constants.DocumentIdFieldName : p.Name).ToArray();

            return(SelectFields <TProjection>(fields, projections));
        }
All Usage Examples Of Raven.Client.Document.DocumentConvention::GetIdentityProperty