Changeset 3217 for trunk/sources/HeuristicLab.Services.Deployment
- Timestamp:
- 03/25/10 17:14:05 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Services.Deployment/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Services.Deployment/3.3/PluginDescription.cs
r3084 r3217 27 27 28 28 namespace HeuristicLab.Services.Deployment { 29 [DataContract(Name = "PluginDescription" )]29 [DataContract(Name = "PluginDescription", IsReference = true)] 30 30 public class PluginDescription { 31 31 … … 34 34 public string Name { 35 35 get { return name; } 36 set { 37 if (string.IsNullOrEmpty(value)) throw new ArgumentException(); 38 name = value; 39 } 36 40 } 37 41 … … 40 44 public Version Version { 41 45 get { return version; } 46 set { 47 if (value == null) throw new ArgumentNullException(); 48 version = value; 49 } 42 50 } 43 51 … … 46 54 public string ContactName { 47 55 get { return contactName; } 56 set { 57 if (value == null) throw new ArgumentNullException(); 58 contactName = value; 59 } 48 60 } 49 61 … … 52 64 public string ContactEmail { 53 65 get { return contactEmail; } 66 set { 67 if (value == null) throw new ArgumentNullException(); 68 contactEmail = value; 69 } 54 70 } 55 71 … … 58 74 public string LicenseText { 59 75 get { return licenseText; } 76 set { 77 if (value == null) throw new ArgumentNullException(); 78 licenseText = value; 79 } 60 80 } 61 81 … … 64 84 public List<PluginDescription> Dependencies { 65 85 get { return dependencies; } 86 set { 87 if (value == null) throw new ArgumentNullException(); 88 dependencies = value; 89 } 66 90 } 67 91 68 public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies, 92 public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies, 69 93 string contactName, string contactEmail, string license) { 70 94 if (string.IsNullOrEmpty(name)) throw new ArgumentException("name is empty"); -
trunk/sources/HeuristicLab.Services.Deployment/3.3/PluginStore.cs
r3084 r3217 45 45 where plugin.Id == pair.PluginId 46 46 select plugin 47 select MakeProductDescription(ctx, p, plugins )).ToList();47 select MakeProductDescription(ctx, p, plugins.ToList())).ToList(); 48 48 } 49 49 } … … 169 169 170 170 // delete cached entry 171 if (pluginDescriptions.ContainsKey(pluginEntity )) pluginDescriptions.Remove(pluginEntity);171 if (pluginDescriptions.ContainsKey(pluginEntity.Id)) pluginDescriptions.Remove(pluginEntity.Id); 172 172 173 173 DeleteOldDependencies(ctx, pluginEntity); … … 195 195 196 196 #region product <-> productDescription transformation 197 private ProductDescription MakeProductDescription(PluginStoreClassesDataContext ctx, Product p, I Queryable<Plugin> plugins) {197 private ProductDescription MakeProductDescription(PluginStoreClassesDataContext ctx, Product p, IEnumerable<Plugin> plugins) { 198 198 var desc = new ProductDescription(p.Name, new Version(p.Version), from plugin in plugins 199 199 select MakePluginDescription(ctx, plugin)); … … 210 210 #region plugin <-> pluginDescription transformation 211 211 // cache for plugin descriptions 212 private Dictionary< Plugin, PluginDescription> pluginDescriptions = new Dictionary<Plugin, PluginDescription>();212 private Dictionary<long, PluginDescription> pluginDescriptions = new Dictionary<long, PluginDescription>(); 213 213 private PluginDescription MakePluginDescription(PluginStoreClassesDataContext ctx, Plugin plugin) { 214 if (!pluginDescriptions.ContainsKey(plugin )) {214 if (!pluginDescriptions.ContainsKey(plugin.Id)) { 215 215 // no cached description -> create new 216 var desc = new PluginDescription(plugin.Name, 217 new Version(plugin.Version), 218 from dep in GetDependencies(ctx, plugin) 219 select MakePluginDescription(ctx, dep), 220 plugin.ContactName ?? string.Empty, 221 plugin.ContactEmail ?? string.Empty, 222 plugin.License ?? string.Empty 223 ); 224 pluginDescriptions[plugin] = desc; 225 } 226 return pluginDescriptions[plugin]; 216 var desc = new PluginDescription(plugin.Name, new Version(plugin.Version)); 217 pluginDescriptions[plugin.Id] = desc; // and add to cache 218 219 // fill remaining properties of plugin description 220 desc.Dependencies = new List<PluginDescription>(from dep in GetDependencies(ctx, plugin) select MakePluginDescription(ctx, dep)); 221 desc.ContactEmail = plugin.ContactEmail ?? string.Empty; 222 desc.ContactName = plugin.ContactName ?? string.Empty; 223 desc.LicenseText = plugin.License ?? string.Empty; 224 } 225 return pluginDescriptions[plugin.Id]; 227 226 } 228 227
Note: See TracChangeset
for help on using the changeset viewer.