Exemplo n.º 1
0
        /*
         * public static void SetUpRevision(this IRevisionAccessor revisionAccessor, Type type, string fieldName)
         * {
         *  if (fieldName == null) throw new ArgumentNullException(nameof(fieldName));
         *  FieldMeta fieldInfo = type.GetTypeMeta().Fields.FirstOrDefault(x => x.Name == fieldName);
         *  revisionAccessor.SetRevision(type, fieldInfo);
         * }
         */

        /// <summary>
        /// Set the Revision directly against a Type
        /// </summary>
        /// <typeparam name="T">the tpye which to set the Revision against</typeparam>
        /// <param name="field">Revision Field</param>
        public static void SetUpRevision <T>(this IRevisionAccessor revisionAccessor, FieldInfo field)
        {
            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }
            revisionAccessor.SetUpRevision(typeof(T), field);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set the Revision directly against a Type
        /// </summary>
        /// <typeparam name="T">the tpye which to set the Revision against</typeparam>
        /// <param name="fieldName">name of the Revision field</param>
        public static void SetUpRevision <T>(this IRevisionAccessor revisionAccessor, string fieldName)
        {
            if (fieldName == null)
            {
                throw new ArgumentNullException(nameof(fieldName));
            }
            FieldMeta fieldInfo = typeof(T).GetTypeMeta().Fields.FirstOrDefault(x => x.Name == fieldName);

            revisionAccessor.SetUpRevision(typeof(T), fieldInfo?.FieldInfo);
        }