private void ProcessMethodDescriptions(Type fromType, MethodMap svcMethods, OperationalMethods operMethods, DbSetsDictionary dbSets, ILookup <Type, DbSetInfo> dbSetsByTypeLookUp)
        {
            IEnumerable <MethodInfoData> allList = _GetAllMethods(fromType);

            InitSvcMethods(allList.GetSvcMethods(valueConverter), svcMethods, dbSets, dbSetsByTypeLookUp);

            IEnumerable <MethodInfoData> otherMethods = allList.GetOthersOnly();

            InitOperMethods(otherMethods, operMethods, dbSetsByTypeLookUp);
        }
 public RunTimeMetadata(DbSetsDictionary dbSets,
                        ILookup <Type, DbSetInfo> dbSetsByTypeLookUp,
                        AssociationsDictionary associations,
                        MethodMap svcMethods,
                        OperationalMethods operMethods,
                        string[] typeScriptImports)
 {
     DbSets = dbSets;
     this.dbSetsByTypeLookUp = dbSetsByTypeLookUp;
     Associations            = associations;
     _svcMethods             = svcMethods;
     _operMethods            = operMethods;
     TypeScriptImports       = typeScriptImports;
 }
        private void InitOperMethods(IEnumerable <MethodInfoData> methods, OperationalMethods operMethods, ILookup <Type, DbSetInfo> dbSetsByTypeLookUp)
        {
            MethodInfoData[] otherMethods = methods.ToArray();

            Array.ForEach(otherMethods, md =>
            {
                if (md.EntityType != null)
                {
                    IEnumerable <DbSetInfo> dbSets = dbSetsByTypeLookUp[md.EntityType];

                    foreach (DbSetInfo dbSetInfo in dbSets)
                    {
                        operMethods.Add(dbSetInfo.dbSetName, md);
                    }
                }
                else
                {
                    operMethods.Add("", md);
                }
            });
        }
        public RunTimeMetadata Build()
        {
            DbSetsDictionary dbSets = new DbSetsDictionary();

            foreach (DbSetInfo dbSetInfo in designTimeMetadata.DbSets)
            {
                dbSets.Add(dbSetInfo.dbSetName, dbSetInfo);
            }

            foreach (DbSetInfo dbSetInfo in dbSets.Values)
            {
                dbSetInfo.Initialize(dataHelper);
            }

            ILookup <Type, DbSetInfo> dbSetsByTypeLookUp = dbSets.Values.ToLookup(v => v.GetEntityType());
            MethodMap          svcMethods  = new MethodMap();
            OperationalMethods operMethods = new OperationalMethods();

            foreach (Config.ServiceTypeDescriptor descriptor in dataManagerContainer.Descriptors)
            {
                ProcessMethodDescriptions(descriptor.ImplementationType, svcMethods, operMethods, dbSets, dbSetsByTypeLookUp);
            }

            ProcessMethodDescriptions(domainServiceType, svcMethods, operMethods, dbSets, dbSetsByTypeLookUp);

            operMethods.MakeReadOnly();
            svcMethods.MakeReadOnly();

            AssociationsDictionary associations = new AssociationsDictionary();

            foreach (Association assoc in designTimeMetadata.Associations)
            {
                ProcessAssociation(assoc, dbSets, associations);
            }

            return(new RunTimeMetadata(dbSets, dbSetsByTypeLookUp, associations, svcMethods, operMethods, designTimeMetadata.TypeScriptImports.ToArray()));
        }