public static string GetTypeScriptName(ITypeMetadata metadata) { if (metadata == null) return "any"; if (metadata.IsEnumerable) { var genericTypeArguments = metadata.GenericTypeArguments.ToList(); if (genericTypeArguments.Count == 1) return GetTypeScriptName(genericTypeArguments.FirstOrDefault()) + "[]"; if (genericTypeArguments.Count == 2) { var key = GetTypeScriptName(genericTypeArguments[0]); var value = GetTypeScriptName(genericTypeArguments[1]); return string.Concat("{ [key: ", key, "]: ", value, "; }"); } return "any"; } if (metadata.IsGeneric) return metadata.Name + string.Concat("<", string.Join(", ", metadata.GenericTypeArguments.Select(GetTypeScriptName)), ">"); return ExtractTypeScriptName(metadata); }
private static string ExtractTypeScriptName(ITypeMetadata metadata) { var fullName = metadata.IsNullable ? metadata.FullName.TrimEnd('?') : metadata.FullName; switch (fullName) { case "System.Boolean": return "boolean"; case "System.String": case "System.Char": case "System.Guid": case "System.TimeSpan": return "string"; case "System.Byte": case "System.SByte": case "System.Int16": case "System.Int32": case "System.Int64": case "System.UInt16": case "System.UInt32": case "System.UInt64": case "System.Single": case "System.Double": case "System.Decimal": return "number"; case "System.DateTime": case "System.DateTimeOffset": return "Date"; case "System.Void": return "void"; } return metadata.IsNullable ? metadata.Name.TrimEnd('?') : metadata.Name; }
/// <summary> /// Deserialize a user type instance from a POF stream by reading its /// state using the specified <see cref="IPofReader"/> object. /// </summary> /// <remarks> /// An implementation of <b>IPofSerializer</b> is required to follow /// the following steps in sequence for reading in an object of a /// user type: /// <list type="number"> /// <item> /// <description> /// If the object is evolvable, the implementation must get the /// version by calling <see cref="IPofWriter.VersionId"/>. /// </description> /// </item> /// <item> /// <description> /// The implementation may read any combination of the /// properties of the user type by using "read" methods of the /// <b>IPofReader</b>, but it must do so in the order of the property /// indexes. /// </description> /// </item> /// <item> /// <description> /// After all desired properties of the user type have been read, /// the implementation must terminate the reading of the user type by /// calling <see cref="IPofReader.ReadRemainder"/>. /// </description> /// </item> /// </list> /// </remarks> /// <param name="reader"> /// The <b>IPofReader</b> with which to read the object's state. /// </param> /// <returns> /// The deserialized user type instance. /// </returns> /// <exception cref="IOException"> /// If an I/O error occurs. /// </exception> public virtual object Deserialize(IPofReader reader) { ITypeMetadata <object> tmd = m_tmd; object value = tmd.NewInstance(); // set the version identifier bool isEvolvable = value is IEvolvable; IEvolvable evolvable = null; if (isEvolvable) { evolvable = (IEvolvable)value; evolvable.DataVersion = reader.VersionId; } // POF Annotation processing for (IEnumerator enmr = tmd.GetAttributes(); enmr.MoveNext();) { IAttributeMetadata <object> attr = (IAttributeMetadata <object>)enmr.Current; attr.Set(value, attr.Codec.Decode(reader, attr.Index)); } // read any future properties Binary remainder = reader.ReadRemainder(); if (isEvolvable) { evolvable.FutureData = remainder; } return(value); }
/// <summary> /// Compare the TypeMetadata with another TypeMetadata object to /// determine equality. /// </summary> /// <remarks> /// Two TypeMetadata objects are considered equal iff their /// <see cref="ITypeKey"/> values and /// <see cref="IAttributeMetadata{T}"/>s are equal. /// </remarks> /// <param name="that"> /// ITypeMetadata instance to compare this instance to. /// </param> /// <returns> /// <c>true</c> iff this TypeMetadata and the passed object are /// equivalent. /// </returns> public virtual bool Equals(ITypeMetadata <T> that) { if (this == that) { return(true); } // check key and version if (!Equals(Key, that.Key)) { return(false); } for (IEnumerator enmrThis = GetAttributes(), enmrThat = that.GetAttributes(); ;) { var attributeThis = enmrThis.MoveNext() ? enmrThis.Current : null; var attributeThat = enmrThat.MoveNext() ? enmrThat.Current : null; if (!Equals(attributeThis, attributeThat)) { return(false); } // we assume an attribute returned by the enmr will never be null if (attributeThis == null && attributeThat == null) { break; } } return(true); }
private TypeImpl(ITypeMetadata metadata, Item parent) { _metadata = metadata; Parent = parent; _lazyName = new Lazy<string>(() => GetTypeScriptName(metadata)); _lazyOriginalName = new Lazy<string>(() => GetOriginalName(metadata)); }
public static string GetTypeScriptName(ITypeMetadata metadata) { if (metadata == null) { return("any"); } if (metadata.IsEnumerable) { var typeArguments = metadata.TypeArguments.ToList(); if (typeArguments.Count == 1) { return(GetTypeScriptName(typeArguments.FirstOrDefault()) + "[]"); } if (typeArguments.Count == 2) { var key = GetTypeScriptName(typeArguments[0]); var value = GetTypeScriptName(typeArguments[1]); return(string.Concat("{ [key: ", key, "]: ", value, "; }")); } return("any[]"); } if (metadata.IsGeneric) { return(metadata.Name + string.Concat("<", string.Join(", ", metadata.TypeArguments.Select(GetTypeScriptName)), ">")); } return(ExtractTypeScriptName(metadata)); }
private TypeImpl(ITypeMetadata metadata, Object parent) { _metadata = metadata; Parent = parent; _lazyName = new LazyString(() => Helpers.GetOriginalName(metadata)); _lazyTypescriptName = new LazyString(() => Helpers.GetTypeScriptName(metadata)); }
private TypeImpl(ITypeMetadata metadata, Item parent) { _metadata = metadata; Parent = parent; _lazyName = new Lazy <string>(() => GetTypeScriptName(metadata)); _lazyOriginalName = new Lazy <string>(() => GetOriginalName(metadata)); }
public InputModelFormatter(ITypeMetadata metadata) { var model = (IInputModel)Activator.CreateInstance(metadata.Type); if (model == null) { throw new InvalidTypeSettingException(metadata.Name, typeof(IInputModel), metadata.Type); } if (model.CommandType == null || string.IsNullOrEmpty(model.CommandType.Name)) { throw new CommandTypeNotSpecifiedException(string.Format( "The input model {0} has not set it's CommandType property", metadata.Name)); } _commandName = model.CommandType.Name; _modelName = metadata.Type.Name; _properties = metadata.Properties.Select(pi => new Property { Name = pi.Name, Type = pi.PropertyType.Name, Value = pi.PropertyType.GetDefaultValue(), Choices = pi.PropertyType.IsEnum ? Enum.GetNames(pi.PropertyType) : null, MultiChoice = pi.PropertyType.GetCustomAttributes(typeof(FlagsAttribute), false).Length > 0 }).ToList(); }
public void DerivedClassTest() { ITypeMetadata derivedClass = _sut.AssemblyModel.Namespaces .Single(x => x.Name == "TPA.ApplicationArchitecture.Data") .Types.Single(x => x.Name == "DerivedClass"); Assert.IsNotNull(derivedClass.BaseType); }
public void ClassWithAttributesTest() { ITypeMetadata attributeClass = _sut.AssemblyModel.Namespaces .Single(x => x.Name == "TPA.ApplicationArchitecture.Data") .Types.Single(x => x.Name == "ClassWithAttribute"); Assert.AreEqual(1, attributeClass.Attributes.Count()); }
public void StructureTest() { ITypeMetadata structure = _sut.AssemblyModel.Namespaces .Single(x => x.Name == "TPA.ApplicationArchitecture.Data") .Types.Single(x => x.Name == "Structure"); Assert.AreEqual(TypeKindEnum.StructType, structure.TypeKind); }
public void StaticClassTest() { ITypeMetadata staticClass = _sut.AssemblyModel.Namespaces .Single(x => x.Name == "TPA.ApplicationArchitecture.Data"). Types.Single(x => x.Name == "StaticClass"); Assert.AreEqual(StaticEnum.Static, staticClass.Methods.Single(x => x.Name == "StaticMethod1").Modifiers.Item3); }
public static string GetOriginalName(ITypeMetadata metadata) { var name = metadata.Name; var fullName = metadata.IsNullable ? metadata.FullName.TrimEnd('?') : metadata.FullName; if (primitiveTypes.ContainsKey(fullName)) name = primitiveTypes[fullName] + (metadata.IsNullable ? "?" : string.Empty); return name; }
public void AbstractClassTest() { ITypeMetadata abstractClass = _sut.AssemblyModel.Namespaces .Single(x => x.Name == "TPA.ApplicationArchitecture.Data") .Types.Single(x => x.Name == "AbstractClass"); Assert.AreEqual(AbstractEnum.Abstract, abstractClass.Modifiers.Item3); Assert.AreEqual(AbstractEnum.Abstract, abstractClass.Methods.Single(x => x.Name == "AbstractMethod").Modifiers.Item2); }
public static string GetTypeScriptName(ITypeMetadata metadata) { if (metadata == null) { return("any"); } if (metadata.IsEnumerable) { var typeArguments = metadata.TypeArguments.ToList(); if (typeArguments.Count == 0) { if (metadata.BaseClass != null && metadata.BaseClass.IsGeneric) { typeArguments = metadata.BaseClass.TypeArguments.ToList(); } else { var genericInterface = metadata.Interfaces.FirstOrDefault(i => i.IsGeneric); if (genericInterface != null) { typeArguments = genericInterface.TypeArguments.ToList(); } } if (typeArguments.Any(t => t.FullName == metadata.FullName)) { return("any[]"); } } if (typeArguments.Count == 1) { return(GetTypeScriptName(typeArguments.FirstOrDefault()) + "[]"); } if (typeArguments.Count == 2) { var key = GetTypeScriptName(typeArguments[0]); var value = GetTypeScriptName(typeArguments[1]); return(string.Concat("{ [key: ", key, "]: ", value, "; }")); } return("any[]"); } if (metadata.IsGeneric) { return(metadata.Name + string.Concat("<", string.Join(", ", metadata.TypeArguments.Select(GetTypeScriptName)), ">")); } return(ExtractTypeScriptName(metadata)); }
public void InterfaceTest() { ITypeMetadata interfaceClass = _sut.AssemblyModel.Namespaces .Single(x => x.Name == "TPA.ApplicationArchitecture.Data") .Types.Single(x => x.Name == "IExample"); Assert.AreEqual(TypeKindEnum.InterfaceType, interfaceClass.TypeKind); Assert.AreEqual(AbstractEnum.Abstract, interfaceClass.Modifiers.Item3); Assert.AreEqual(AbstractEnum.Abstract, interfaceClass.Methods.Single(x => x.Name == "MethodA").Modifiers.Item2); }
public static string GetOriginalName(ITypeMetadata metadata) { var name = metadata.Name; var fullName = metadata.IsNullable ? metadata.FullName.TrimEnd('?') : metadata.FullName; if (primitiveTypes.ContainsKey(fullName)) { name = primitiveTypes[fullName] + (metadata.IsNullable ? "?" : string.Empty); } return(name); }
/// <summary> /// Recupera os metadados do tipo. /// </summary> /// <param name="result"></param> /// <returns></returns> private ITypeMetadata GetTypeMetadata(ITypeMetadata result) { var typeMetadata = result as Local.TypeMetadata; if (typeMetadata != null && typeMetadata.BaseTypes.Any()) { result = new AggregateTypeMetadata(new[] { result }.Concat(typeMetadata.BaseTypes.Select(f => _schemas.Select(x => x.GetTypeMetadata(f.FullName)).FirstOrDefault(x => x != null)).Where(f => f != null))); } return(result); }
public ActionResult ViewPart(ITypeMetadata typeMetadata, IPartCollection containingCollection, string format) { ViewBag.Title = typeMetadata.Name; return View(new PartModel { TypeMetadata = typeMetadata, NextActionName = (containingCollection.DescriptiveName == "Commands") ? "ViewCommand" : "ViewPart", AgentSytemName = containingCollection.AgentSystemName, PartDescriptiveName = containingCollection.DescriptiveName, PartType = typeMetadata.Type.Name }); }
public void TestImplyIndicies() { TypeMetadataBuilder <PoffedImpliedIndicies> builder = new TypeMetadataBuilder <PoffedImpliedIndicies>(); IVisitor <TypeMetadataBuilder <PoffedImpliedIndicies> > visitor = new AnnotationVisitor <TypeMetadataBuilder <PoffedImpliedIndicies>, PoffedImpliedIndicies>(true); builder.SetTypeId(1002); builder.Accept(visitor, typeof(PoffedImpliedIndicies)); ITypeMetadata <PoffedImpliedIndicies> tmd = builder.Build(); Assert.AreEqual(1002, tmd.Key.TypeId); Assert.AreEqual(2, tmd.GetAttribute("lastName").Index); Assert.AreEqual(1, tmd.GetAttribute("firstName").Index); Assert.AreEqual(0, tmd.GetAttribute("age").Index); }
public static bool TryAddEnumItem( this List <SearcherItem> items, SearcherItem itemToAdd, ITypeMetadata meta, string parentName = "" ) { if (meta.IsEnum) { items.AddAtPath(itemToAdd, parentName + "/" + k_Enums); return(true); } return(false); }
public static IEnumerable <MemberInfoValue> GetMembers(this ITypeMetadata metadata, BindingFlags flags) { var privateAndPublicFlags = BindingFlags.Public | BindingFlags.NonPublic; if ((flags & privateAndPublicFlags) == privateAndPublicFlags) { return(metadata.PublicMembers.Concat(metadata.NonPublicMembers)); } if ((flags & BindingFlags.NonPublic) != 0) { return(metadata.NonPublicMembers); } //if ((flags & BindingFlags.Public) != 0) return(metadata.PublicMembers); }
public void ImplementedInterfaceTest() { ITypeMetadata interfaceClass = _sut.AssemblyModel.Namespaces .Single(x => x.Name == "TPA.ApplicationArchitecture.Data") .Types.Single(x => x.Name == "IExample"); ITypeMetadata implementedInterfaceClass = _sut.AssemblyModel.Namespaces .Single(x => x.Name == "TPA.ApplicationArchitecture.Data") .Types.Single(x => x.Name == "ImplementationOfIExample"); Assert.AreEqual("IExample", implementedInterfaceClass.ImplementedInterfaces.Single().Name); foreach (IMethodMetadata method in interfaceClass.Methods) { Assert.IsNotNull(implementedInterfaceClass.Methods.SingleOrDefault(x => x.Name == method.Name)); } }
List <SearcherItem> SearcherItemsForType(int recursiveDepth, ITypeMetadata currentType, string currentPath, int parentsHashCode, BindingFlags flags) { List <SearcherItem> searcherItems = null; foreach (var member in currentType.GetMembers(flags)) { var childItem = SearcherItemForType(recursiveDepth, currentPath, parentsHashCode, member); searcherItems = searcherItems ?? new List <SearcherItem>(); searcherItems.Add(childItem); } return(searcherItems); }
public void TestVisit() { TypeMetadataBuilder <Poffed> builder = new TypeMetadataBuilder <Poffed>(); IVisitor <TypeMetadataBuilder <Poffed> > visitor = new AnnotationVisitor <TypeMetadataBuilder <Poffed>, Poffed>(); builder.SetTypeId(1001); builder.Accept(visitor, typeof(Poffed)); ITypeMetadata <Poffed> tmd = builder.Build(); Assert.AreEqual(1001, tmd.Key.TypeId); Assert.AreEqual(0, tmd.GetAttribute("lastName").Index); Assert.AreEqual(1, tmd.GetAttribute("age").Index); Assert.AreEqual(2, tmd.GetAttribute("firstName").Index); }
public void TestAccessorAnnotations() { TypeMetadataBuilder <PoffedMethodInspection> builder = new TypeMetadataBuilder <PoffedMethodInspection>(); IVisitor <TypeMetadataBuilder <PoffedMethodInspection> > visitor = new AnnotationVisitor <TypeMetadataBuilder <PoffedMethodInspection>, PoffedMethodInspection>(true); builder.SetTypeId(1005); builder.Accept(visitor, typeof(PoffedMethodInspection)); ITypeMetadata <PoffedMethodInspection> tmd = builder.Build(); Assert.AreEqual(1005, tmd.Key.TypeId); Assert.AreEqual(0, tmd.GetAttribute("adult").Index); Assert.AreEqual(1, tmd.GetAttribute("age").Index); Assert.AreEqual(2, tmd.GetAttribute("firstName").Index); Assert.AreEqual(3, tmd.GetAttribute("lastName").Index); }
internal static bool TryAddClassItem( this List <SearcherItem> items, SearcherItem itemToAdd, ITypeMetadata meta, string parentName = "" ) { if ((meta.IsClass || meta.IsValueType) && !meta.IsEnum) { var path = BuildPath(parentName + "/" + k_Class, meta); items.AddAtPath(itemToAdd, path); return(true); } return(false); }
PropertySearcherItem SearcherItemForType(int depth, string path, int parentHash, MemberInfoValue member) { TypeHandle memberType = member.UnderlyingType; ITypeMetadata memberTypeMetadataCSharp = m_Resolver.Resolve(memberType); string memberName = member.Name; int hashCode = GenerateSearcherItemHashCode(parentHash, memberName); List <SearcherItem> childItems = null; if (depth > 0) { childItems = SearcherItemsForType(depth - 1, memberTypeMetadataCSharp, path + " " + memberName, hashCode, m_RecursiveFlags); } return(CreateSearcherItem(path, member, hashCode, childItems)); }
public static bool TryAddGraphItem( this List <SearcherItem> items, SearcherItem itemToAdd, ITypeMetadata meta, string parentName = "" ) { if (meta is GraphBasedMetadata) { var path = BuildPath(parentName + "/" + k_Graphs, meta); items.AddAtPath(itemToAdd, path); return(true); } return(false); }
public void GenericClassTest() { ITypeMetadata genericClass = _sut.AssemblyModel.Namespaces .Single(x => x.Name == "TPA.ApplicationArchitecture.Data") .Types.Single(x => x.Name.Contains("GenericClass")); Assert.AreEqual(1, genericClass.GenericArguments.Count()); Assert.AreEqual("T", genericClass.GenericArguments.Single().Name); Assert.AreEqual("T", genericClass.Properties.Single(x => x.Name == "GenericProperty") .MyType.Name); Assert.AreEqual(1, genericClass.Methods.Single(x => x.Name == "GenericMethod").Parameters.Count()); Assert.AreEqual("T", genericClass.Methods.Single(x => x.Name == "GenericMethod") .Parameters.Single().MyType.Name); Assert.AreEqual("T", genericClass.Methods.Single(x => x.Name == "GenericMethod").ReturnType.Name); //TypeMetaData lacks Fields info }
/// <summary> /// Recupera os metadados do tipo com o nome informado. /// </summary> /// <param name="fullName">Nome completo do tipo.</param> /// <returns>Instancia dos metadados do tipo.</returns> public ITypeMetadata GetTypeMetadata(string fullName) { ITypeMetadata result = null; lock (_objLock) { if (!_typeMetadatasFromFullName.TryGetValue(fullName, out result) && _typeMetadataLoaderFromFullName != null) { result = _typeMetadataLoaderFromFullName(fullName); if (result != null) { InternalAddTypeMetadata(result); } } } return(result); }
/// <summary> /// Recupera os metadados do tipo com base no código informado. /// </summary> /// <param name="typeCode">Código do tipo.</param> /// <returns></returns> public ITypeMetadata GetTypeMetadata(int typeCode) { ITypeMetadata result = null; lock (_objLock) { if (!_typeMetadatasFromTypeCode.TryGetValue(typeCode, out result) && _typeMetadataLoaderFromTypeCode != null) { result = _typeMetadataLoaderFromTypeCode(typeCode); if (result != null) { InternalAddTypeMetadata(result); } } } return(result); }
public void TestCustomCodec() { TypeMetadataBuilder <PoffedCustomCodec> builder = new TypeMetadataBuilder <PoffedCustomCodec>(); IVisitor <TypeMetadataBuilder <PoffedCustomCodec> > visitor = new AnnotationVisitor <TypeMetadataBuilder <PoffedCustomCodec>, PoffedCustomCodec>(true); builder.SetTypeId(1004); builder.Accept(visitor, typeof(PoffedCustomCodec)); ITypeMetadata <PoffedCustomCodec> tmd = builder.Build(); Assert.AreEqual(1004, tmd.Key.TypeId); Assert.AreEqual(0, tmd.GetAttribute("age").Index); Assert.AreEqual(1, tmd.GetAttribute("aliases").Index); Assert.AreEqual(2, tmd.GetAttribute("firstName").Index); Assert.AreEqual(3, tmd.GetAttribute("lastName").Index); Assert.IsInstanceOf(typeof(LinkedListCodec <string>), tmd.GetAttribute("aliases").Codec); }
public void TestClassMetadata() { MethodInfo method = typeof(ClassMetadataDescribable).GetMethod("GetName"); var builder = new ClassMetadataBuilder <ClassMetadataDescribable>(); ITypeMetadata <ClassMetadataDescribable> tmd = builder.SetClass(typeof(ClassMetadataDescribable)) .SetHash("TestDomain".GetHashCode()) .SetTypeId(1234) .AddAttribute(builder.NewAttribute() .SetIndex(0) .SetName("name") .SetCodec(Codecs.DEFAULT_CODEC) .SetInvocationStrategy(new InvocationStrategies.MethodInvcationStrategy <ClassMetadataDescribable>(method)) .SetVersion(0).Build()).Build(); ITypeMetadata <ClassMetadataDescribable> tmd2 = builder.SetClass(typeof(ClassMetadataDescribable)) .SetHash("TestDomain".GetHashCode()) .SetTypeId(1234) .AddAttribute(builder.NewAttribute() .SetIndex(0) .SetName("name") .SetCodec(Codecs.DEFAULT_CODEC) .SetInvocationStrategy(new InvocationStrategies.MethodInvcationStrategy <ClassMetadataDescribable>(method)) .SetVersion(0).Build()).Build(); Assert.AreEqual(1234, tmd.GetKey().GetTypeId()); Assert.IsTrue(tmd.GetKey().GetHash() != 0); Assert.IsNotNull(tmd.GetAttribute("name")); Assert.AreEqual("name", tmd.GetAttribute("name").GetName()); Assert.AreEqual(0, tmd.GetAttribute("name").GetIndex()); Assert.AreEqual(0, tmd.GetAttribute("name").GetVersion()); Assert.AreEqual(tmd, tmd2); Assert.AreEqual(tmd.GetHashCode(), tmd2.GetHashCode()); ClassMetadataDescribable cmdd = new ClassMetadataDescribable("augusta"); Assert.AreEqual("augusta", tmd.GetAttribute("name").Get(cmdd)); tmd.GetAttribute("name").Set(cmdd, "ada"); Assert.AreEqual("ada", tmd.GetAttribute("name").Get(cmdd)); Assert.IsInstanceOf(typeof(Codecs.DefaultCodec), tmd.GetAttribute("name").GetCodec()); Assert.IsTrue(tmd.GetAttributes().MoveNext()); Assert.IsInstanceOf(typeof(ClassMetadataDescribable), tmd.NewInstance()); object a = (object)"dasd"; }
/// <summary> /// Recupera o nome o tipo de uma metadado de um tipo. /// </summary> /// <param name="typeMetadata"></param> /// <returns></returns> public static Colosoft.Reflection.TypeName GetTypeName(this ITypeMetadata typeMetadata) { if (typeMetadata == null) { return(null); } string fullName = null; if (!string.IsNullOrEmpty(typeMetadata.Assembly)) { fullName = string.Format("{0}.{1}, {2}", typeMetadata.Namespace, typeMetadata.Name, typeMetadata.Assembly); } else { fullName = string.Format("{0}.{1}", typeMetadata.Namespace, typeMetadata.Name); } return(new Reflection.TypeName(fullName)); }
public static IMetadataFormatter GetFormatter(ITypeMetadata metadata) { if (typeof(ICommand).IsAssignableFrom(metadata.Type)) { return new CommandMetadataFormatter(metadata); } else if (typeof(IReadModel).IsAssignableFrom(metadata.Type)) { return new ReadModelFormatter(metadata); } else if (typeof(IQuery).IsAssignableFrom(metadata.Type)) { return new QueryFormatter(metadata); } else if (typeof(IInputModel).IsAssignableFrom(metadata.Type)) { return new InputModelFormatter(metadata); } return new DefaultFormatter(metadata); }
public QueryFormatter(ITypeMetadata partMetadata) { _partMetadata = partMetadata; _agentMetadata = partMetadata.Type.Assembly.GetAgentMetadata(); }
public static Type FromMetadata(ITypeMetadata metadata, Item parent) { return metadata == null ? null : new TypeImpl(metadata, parent); }
public ReadModelFormatter(ITypeMetadata partMetadata) { _partMetadata = partMetadata; }
void IRelationalMappingConvention.ApplyToType(ITypeMetadata type) { ApplyToType((TypeMetadataBuilder)type); }
public ActionResult ViewCommand(IInputModel inputModel, ITypeMetadata typeMetadata, string format) { var partCollection = typeMetadata.GetContainingPartCollection(); ViewBag.Title = typeMetadata.Type.Name; ViewBag.Navigation = new FooterLinkModel { AgentSytemName = partCollection.AgentSystemName, PartDescriptiveName = partCollection.DescriptiveName, PartType = typeMetadata.Type.Name }; ActionResult result = View("ViewCommand", inputModel); return result; }
public DefaultFormatter(ITypeMetadata metadata) { _metadata = metadata; }
//----------------------------------------------------------------------------------------------------------------------------------------------------- public EfEntityConfigurationWriter(ITypeMetadata metadata, MethodWriterBase method, Operand<DbModelBuilder> model) { _model = model; _method = method; _metadata = metadata; }
public static bool IsPrimitive(ITypeMetadata metadata) { var fullName = metadata.FullName; if (metadata.IsNullable) { fullName = fullName.TrimEnd('?'); } else if (metadata.IsEnumerable) { var innerType = metadata.TypeArguments.FirstOrDefault(); if (innerType != null) { fullName = innerType.IsNullable ? innerType.FullName.TrimEnd('?') : innerType.FullName; } else { return false; } } return metadata.IsEnum || primitiveTypes.ContainsKey(fullName); }
//----------------------------------------------------------------------------------------------------------------------------------------------------- public void EnsureRelationalMapping(ITypeMetadata type) { var metadata = (TypeMetadataBuilder)type; metadata.EnsureRelationalMapping(_relationalMappingConvention); }
public CommandMetadataFormatter(ITypeMetadata typeMetadata) { _typeMetadata = typeMetadata; }