Esempio n. 1
0
 private void OnFileLoad()
 {
     samples = typist.SampleNames(edmxFile);
 }
Esempio n. 2
0
        public EdmxNamesSample SampleNames(string source, int max = int.MaxValue)
        {
            xdoc = GetXdoc(source);

            var root = xdoc.Root;
            Debug.Assert(root != null, "root != null");

            var sample = new EdmxNamesSample();

            var eSets = root.Descendants(edmNS + "EntitySet");

            sample.EntitySets = eSets.Select((xe, i) => xe.Att("Name")).Distinct().Take(max).ToList();

            sample.EntityTypes = eSets.Select((xe, i) => xe.Att("EntityType").Split('.').Last()).Distinct().Take(max).ToList();

            sample.Scalars = root.Descendants(edmNS + "Property")
                    .Select((x, i) => x.Att("Name")).Distinct().Take(max).ToList();

            sample.NavigationProperties = root.Descendants(edmNS + "NavigationProperty")
                    .Select((x, i) => x.Att("Name")).Distinct().Take(max).ToList();

            sample.ComplexTypes = root.Descendants(edmNS + "ComplexType")
                    .Select((x, i) => x.Att("Name")).Distinct().Take(max).ToList();

            sample.ComplexProperties = root.Descendants(XName.Get("ComplexProperty", MSL_NS))
                    .Select((x, i) => x.Att("Name")).Distinct().Take(max).ToList();

            sample.Methods = root.Descendants(XName.Get("Function", SSDL_NS))
                    .Select((x, i) => x.Att("Name").Split('.').Last()).Distinct().Take(max).ToList();

            // associations
            sample.Associations = root.Descendants(edmNS + "End")
                    .Select((x, i) => x.Att("Role")).Distinct().Take(max).ToList();

            return sample;
        }