Esempio n. 1
0
        public VersionId_I NewVersionId()
        {
            var id = new VersionId()
            {
            };

            XIdentification.IssueId(id);

            return(id);
        }
Esempio n. 2
0
        public object New(Type type)
        {
            try
            {
                var x = type.GetConstructor(System.Type.EmptyTypes);

                if (x == null)
                {
                    // Need to be using an log message type so that the exceptions can be filtered by a more advnced logging package.  This gets rid of the need to pass in a global context,
                    // as a more advanced logging system can filter the messages by type if it needed to adjust the verbosity.
                    XLogBase.LogError(null, new NoPublicConstructorsWithEmptyArguementsLogMessage()
                    {
                        Message = new Message()
                        {
                            Value = $"There are no public empty argument constructors for type '{type.AssemblyQualifiedName}'.  An instance could not be created."
                        }
                    });

                    //XLogBase.LogError(XContextualBase.GetGlobal(), $"There are no public empty argument constructors for type '{type.AssemblyQualifiedName}'.  An instance could not be created.");



                    return(null);
                }

                var result = x.Invoke(null);

                var resultId = result as Ided_I;

                if (resultId != null)
                {
                    resultId.Id = XIdentification.IssueId();
                }

                var typed = result as Typed_I;

                if (typed != null)
                {
                    if (typed?.TypeId == null)
                    {
                        typed.TypeId = XTypeIdentification.GetTypeId(type);
                    }
                }

                return(result);
            }
            catch (System.Exception exception)
            {
                //XLogBase.LogException(XContextualBase.GetGlobal(), exception);

                XLogBase.LogException(null, exception);

                return(null);
            }
        }
Esempio n. 3
0
File: BootApi.cs Progetto: E01D/Base
        public void OnBoot()
        {
            // Given the settings have been setup, the identification system can load.
            XIdentification.Initialize();

            if (XNew.Api.Factory is ObjectFactoryApi)
            {
                // Change the object factory to look for types that implement Ided_I and set the identifier.
                XNew.Api.Factory = new IdentificationObjectFactory();
            }

            //XTypal.Initialize();

            // We want to enable as many systems as possible to be able to be setup dynamically.  A type scan is needed. To identify dynamic components
            // The type scan needs to ultimately build a semantic model, and this model requires th use of identifiers.  This is to enable it to
            // house runtime types and types that are not yet built in the same model.  This was change from the first version.
            XReflection.Api.Scanning.IO.ScanEntryAssemblyDirectoryForAssemblies();


            //// load data before logic to prevent logics from being called without data present.
            XData.LoadApis();



            //XLogic.LoadApis();

            //LoadLogicApis();

            //if (_.Instance.Associations == null)
            //{
            //    _.Instance.Associations = new AssociationApi();
            //}

            //// With the logic and data types identified via the logic and data apis, the typas can be created.
            //EnsureLogicDataTypes();

            //var context = _.CreateContext();

            //_.StartOperation(context);

            //// Phase 2 Type load
            //XTypal.EnsureTypasAreStored(context);

            //CreateSqlStatementsForDataTypas();  // nothign was there before
        }
Esempio n. 4
0
        private TypeId_I GetStandardTypeIdTypeId(TypeGlobalContext_I context)
        {
            lock (context.SyncRoot)
            {
                if (context.StandardTypeIdTypeId == null)
                {
                    StandardTypeId id = new StandardTypeId();

                    XIdentification.IssueId(id);

                    id.TypeId = id;

                    context.StandardTypeIdTypeId = id;
                }

                return(context.StandardTypeIdTypeId);
            }
        }
Esempio n. 5
0
        public TypeId_I AddTypeId(RuntimeTypeHandle typeHandle)
        {
            var context = GetGlobalContext();

            lock (context.SyncRoot)
            {
                var standardType = new StandardTypeId()
                {
                    TypeId = GetStandardTypeIdTypeId(context)
                };

                XIdentification.IssueId(standardType);

                context.TypeIdsByTypeHandle.Add(typeHandle, standardType);

                context.TypeHandles.Add(standardType.Value, typeHandle);

                return(standardType);
            }
        }