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; } }
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); } } }
public User LoadUser(string name) { var ef = new EntityFactory(Context); return(ef.LoadEntity <User>(name)); }
public User FindUserByName(Domain domain, string name) { var ef = new EntityFactory(Context); return(ef.LoadEntity <User>(domain.GetFullyQualifiedName(), name)); }
public User LoadUser(Guid guid) { var ef = new EntityFactory(Context); return(ef.LoadEntity <User>(guid)); }