//--------------------------------------------------------------------------------------------------------------------- public static RemoteResource FromId(IfyContext context, int id) { RemoteResource result = new RemoteResource(context); result.Id = id; result.Load(); return(result); }
//--------------------------------------------------------------------------------------------------------------------- public static RemoteResourceEntityCollection GetResources(IfyContext context, RemoteResourceSet resourceSet) { RemoteResourceEntityCollection result = new RemoteResourceEntityCollection(context); result.Template.ResourceSet = resourceSet; IDbConnection dbConnection = context.GetDbConnection(); IDataReader reader = context.GetQueryResult(String.Format("SELECT t.id, t.location, t.name FROM resource AS t WHERE id_set={0}", resourceSet.Id), dbConnection); while (reader.Read()) { RemoteResource resource = new RemoteResource(context); resource.Id = reader.GetInt32(0); resource.ResourceSet = resourceSet; resource.Location = reader.GetString(1); resource.Name = reader.GetString(2); } context.CloseQueryResult(reader, dbConnection); return(result); }