public static MetaEntityTypeStore Parse(EdmxFile file, string fullName, MetaEntitySetStore entitySetStore = null)
        {
            var xEl = file.Storage.D("EntityType").WithName(fullName.LastPart());

            if (xEl != null)
            {
                var m = new MetaEntityTypeStore();

                m.FullName = fullName;
                m.Name = fullName.LastPart();
                m.EntitySetStore = entitySetStore;

                var keyNames = (from k in xEl.D("PropertyRef") select k.Att("Name")).ToList();

                m.PropertiesStores = (from p in xEl.D("Property")
                                       select new MetaPropertyStore()
                                              	{
                                              		FullName = fullName + '.' + p.Att("Name"),
                                                    Name = p.Att("Name"),
                                                    Nullable = p.Att("Nullable") == "true",
                                                    Type = p.Att("Type"),
                                                    EntityTypeStore = m,
                                                    isKey = keyNames.Contains(p.Att("Name"))
                                              	}).ToList();

                return m;
            }

            return null;
        }
Example #2
0
        public MetaModel(EdmxFile file)
        {
            EdmxFile = file;
            Namespace = file.Concept.Att("Namespace");

            foreach (var cType in file.Concept.Es("ComplexType"))
            {
                MetaComplexType.Parse(this, cType);
            }

            foreach (var containerNode in file.Concept.D("EntityContainer"))
            {
                MetaContainer.Parse(this, containerNode);
            }
        }
        public static MetaEntitySetStore Parse(EdmxFile file, string fullName)
        {
            var name = fullName.LastPart();
            var xel = file.Storage.D("EntitySet").FirstWhere("Name",name);

            if (xel != null)
            {
                var m = new MetaEntitySetStore();

                m.FullName = fullName;
                m.Name = name;
                m.Type = xel.Att("store:Type");
                m.Schema = xel.Att("Schema");

                m.EntityTypeStore = MetaEntityTypeStore.Parse(file, xel.Att("EntityType"), m);

                return m;
            }

            return null;
        }