public bool TryGetMemberType(Type type, out MemberTypeRegistration registration) { ContentTypeRegistration reg; if (ContentTypeRegister.TryGetContentType(type, out reg)) { registration = reg as MemberTypeRegistration; return(registration != null); } else { registration = null; return(false); } }
protected override ContentTypeRegistration CreateRegistration(Type type) { var memberTypeAttribute = type.GetCodeFirstAttribute <MemberTypeAttribute>(); if (memberTypeAttribute != null) { var props = new List <PropertyRegistration>(); var tabs = new List <TabRegistration>(); var comps = new List <ContentTypeCompositionRegistration>(); MemberTypeRegistration registration = new MemberTypeRegistration( props, tabs, comps, memberTypeAttribute.Alias, memberTypeAttribute.Name, type, memberTypeAttribute); return(registration); } else { throw new CodeFirstException("The specified type does not have a MemberTypeAttribute. Type: " + type.Name); } }
public bool TryGetMemberType <T>(out MemberTypeRegistration registration) where T : MemberTypeBase { return(TryGetMemberType(typeof(T), out registration)); }