Breeze.Entities.BreezeEntityBuilder.LookupEntityType C# (CSharp) Method

LookupEntityType() protected method

Get the C# type from the entity type name. Uses the modelAssemblies property to look up the entities.
protected LookupEntityType ( string entityTypeName ) : Type
entityTypeName string Name in the form "Customer:#My.App.Namespace"
return System.Type
        protected Type LookupEntityType(string entityTypeName)
        {
            var delims = new string[] { ":#" };
            var parts = entityTypeName.Split(delims, StringSplitOptions.None);
            var shortName = parts[0];
            var ns = parts[1];

            var typeName = ns + "." + shortName;
            var type = modelAssemblies
              .Select(a => a.GetType(typeName, false, true))
              .FirstOrDefault(t => t != null);

            if (type != null)
                return type;
            else
                throw new ArgumentException("Assembly could not be found for " + entityTypeName);
        }