Exemplo n.º 1
0
        protected void LoadEntity(Context context)
        {
            if (this.value == null)
            {
                var ef = new EntityFactory(context);

                if (this.guid != Guid.Empty)
                {
                    this.value = ef.LoadEntity <T>(this.guid);
                    this.name  = this.value.GetFullyQualifiedName();
                }
                else if (this.name != null)
                {
                    this.value = ef.LoadEntity <T>(this.name);
                    this.guid  = this.value.Guid;
                }
                else
                {
                    throw new InvalidOperationException();
                }
            }
            else
            {
                this.name = this.value.GetFullyQualifiedName();
                this.guid = this.value.Guid;
            }
        }
Exemplo n.º 2
0
        private void SaveRegistry(string filename)
        {
            using (var context = ContextManager.Instance.CreateContext(ConnectionMode.AutoOpen, TransactionMode.AutoCommit))
            {
                var f      = new EntityFactory(context);
                var entity = f.LoadEntity(EntityType.Cluster, Constants.ClusterName);

                using (var outfile = new StreamWriter(filename))
                {
                    f.Serialize(entity, outfile, EntityGroup.All, false);
                }
            }
        }
Exemplo n.º 3
0
        public User LoadUser(string name)
        {
            var ef = new EntityFactory(Context);

            return(ef.LoadEntity <User>(name));
        }
Exemplo n.º 4
0
        public User FindUserByName(Domain domain, string name)
        {
            var ef = new EntityFactory(Context);

            return(ef.LoadEntity <User>(domain.GetFullyQualifiedName(), name));
        }
Exemplo n.º 5
0
        public User LoadUser(Guid guid)
        {
            var ef = new EntityFactory(Context);

            return(ef.LoadEntity <User>(guid));
        }