- Timestamp:
- 01/31/11 18:15:15 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs
r5375 r5402 67 67 target.JobState = source.JobState; 68 68 target.UserId = source.UserId; 69 // target.RequiredPlugins = db.Plugins.Select(x => source.PluginsNeededIds.Contains(x.PluginId)); - this is difficult69 // RequiredPlugins need to be added by Dao 70 70 } 71 71 } … … 109 109 public static DT.Plugin ToDto(Plugin source) { 110 110 if (source == null) return null; 111 return new DT.Plugin { Id = source.PluginId, Name = source.Name, Version = new Version(source.Version) };111 return new DT.Plugin { Id = source.PluginId, Name = source.Name, Version = new Version(source.Version), UserId = source.UserId, IsLocal = source.IsLocal, DateCreated = source.DateCreated }; 112 112 } 113 113 public static Plugin ToEntity(DT.Plugin source) { … … 118 118 public static void ToEntity(DT.Plugin source, Plugin target) { 119 119 if ((source != null) && (target != null)) { 120 target.PluginId = source.Id; target.Name = source.Name; target.Version = source.Version.ToString(); 120 target.PluginId = source.Id; target.Name = source.Name; target.Version = source.Version.ToString(); target.UserId = source.UserId; target.IsLocal = source.IsLocal; target.DateCreated = source.DateCreated; 121 121 } 122 122 } … … 126 126 public static DT.PluginData ToDto(PluginData source) { 127 127 if (source == null) return null; 128 return new DT.PluginData { PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName, PluginDataId = source.PluginDataId};128 return new DT.PluginData { Id = source.PluginDataId, PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName }; 129 129 } 130 130 public static PluginData ToEntity(DT.PluginData source) { … … 135 135 public static void ToEntity(DT.PluginData source, PluginData target) { 136 136 if ((source != null) && (target != null)) { 137 target.PluginId = source.PluginId; target.Data = new Binary(source.Data); 138 target.FileName = target.FileName; 137 target.PluginDataId = source.Id; target.PluginId = source.PluginId; target.Data = new Binary(source.Data); target.FileName = source.FileName; 139 138 } 140 139 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj
r5264 r5402 37 37 <PropertyGroup> 38 38 <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile> 39 </PropertyGroup> 40 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> 41 <DebugSymbols>true</DebugSymbols> 42 <OutputPath>bin\x86\Debug\</OutputPath> 43 <DefineConstants>DEBUG;TRACE</DefineConstants> 44 <DebugType>full</DebugType> 45 <PlatformTarget>x86</PlatformTarget> 46 <CodeAnalysisLogFile>bin\Debug\HeuristicLab.Services.Hive.DataAccess-3.4.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile> 47 <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> 48 <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> 49 <ErrorReport>prompt</ErrorReport> 50 <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 51 <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories> 52 <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets> 53 <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories> 54 <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules> 55 </PropertyGroup> 56 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> 57 <OutputPath>bin\x86\Release\</OutputPath> 58 <DefineConstants>TRACE</DefineConstants> 59 <Optimize>true</Optimize> 60 <DebugType>pdbonly</DebugType> 61 <PlatformTarget>x86</PlatformTarget> 62 <CodeAnalysisLogFile>bin\Release\HeuristicLab.Services.Hive.DataAccess-3.4.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile> 63 <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> 64 <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> 65 <ErrorReport>prompt</ErrorReport> 66 <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> 67 <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories> 68 <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets> 69 <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories> 70 <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules> 39 71 </PropertyGroup> 40 72 <ItemGroup> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
r5375 r5402 56 56 db.Jobs.InsertOnSubmit(entity); 57 57 db.SubmitChanges(); 58 foreach (Guid pluginId in dto.PluginsNeededIds) { 59 db.RequiredPlugins.InsertOnSubmit(new RequiredPlugin() { JobId = entity.JobId, PluginId = pluginId }); 60 } 61 db.SubmitChanges(); 58 62 return entity.JobId; 59 63 } … … 65 69 if (entity == null) db.Jobs.InsertOnSubmit(Convert.ToEntity(dto)); 66 70 else Convert.ToEntity(dto, entity); 71 // todo: update required plugins 67 72 db.SubmitChanges(); 68 73 } … … 232 237 public DT.PluginData GetPluginData(Guid id) { 233 238 using (var db = CreateContext()) { 234 return Convert.ToDto(db.PluginDatas.SingleOrDefault(x => x.Plugin Id == id));239 return Convert.ToDto(db.PluginDatas.SingleOrDefault(x => x.PluginDataId == id)); 235 240 } 236 241 } … … 247 252 db.PluginDatas.InsertOnSubmit(entity); 248 253 db.SubmitChanges(); 249 return entity.Plugin Id;254 return entity.PluginDataId; 250 255 } 251 256 } … … 262 267 public void DeletePluginData(Guid id) { 263 268 using (var db = CreateContext()) { 264 var entity = db.PluginDatas.FirstOrDefault(x => x.Plugin Id == id); //check if all the byte[] is loaded into memory here. otherwise work around to delete without loading it269 var entity = db.PluginDatas.FirstOrDefault(x => x.PluginDataId == id); // todo: check if all the byte[] is loaded into memory here. otherwise work around to delete without loading it 265 270 if (entity != null) db.PluginDatas.DeleteOnSubmit(entity); 266 271 db.SubmitChanges(); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml
r5375 r5402 14 14 <Column Name="Name" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" /> 15 15 <Column Name="Version" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" /> 16 <Column Name="IsLocal" Type="System.Boolean" DbType="Bit" CanBeNull="false" /> 17 <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" /> 18 <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" /> 16 19 <Association Name="Plugin_RequiredPlugin" Member="RequiredPlugins" ThisKey="PluginId" OtherKey="PluginId" Type="RequiredPlugin" /> 17 20 <Association Name="Plugin_PluginData" Member="PluginData" ThisKey="PluginId" OtherKey="PluginId" Type="PluginData" /> … … 77 80 <Table Name="dbo.UptimeCalendar" Member="UptimeCalendars"> 78 81 <Type Name="UptimeCalendar"> 79 <Column Name="UptimeCalendarId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />80 <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />81 <Column Name="StartDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />82 <Column Name="EndDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />83 <Column Name="AllDayEvent" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />84 <Column Name="Recurring" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />82 <Column Name="UptimeCalendarId" Type="System.Guid" DbType="UniqueIdentifier" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 83 <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" /> 84 <Column Name="StartDate" Type="System.DateTime" DbType="DateTime" CanBeNull="false" /> 85 <Column Name="EndDate" Type="System.DateTime" DbType="DateTime" CanBeNull="false" /> 86 <Column Name="AllDayEvent" Type="System.Boolean" DbType="Bit" CanBeNull="false" /> 87 <Column Name="Recurring" Type="System.Boolean" DbType="Bit" CanBeNull="false" /> 85 88 <Column Name="RecurringId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" /> 86 89 <Association Name="Resource_UptimeCalendar" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" /> … … 109 112 <Table Name="" Member="PluginDatas"> 110 113 <Type Name="PluginData"> 114 <Column Name="PluginDataId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" /> 111 115 <Column Name="PluginId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" /> 112 116 <Column Name="Data" Type="System.Data.Linq.Binary" DbType="VarBinary(MAX) NOT NULL" CanBeNull="false" UpdateCheck="Never" /> 113 117 <Column Name="FileName" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" /> 114 <Column Name="PluginDataId" Type="System.Int32" DbType="Int IDENTITY(1,1)" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />115 118 <Association Name="Plugin_PluginData" Member="Plugin" ThisKey="PluginId" OtherKey="PluginId" Type="Plugin" IsForeignKey="true" /> 116 119 </Type> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout
r5375 r5402 9 9 </nestedChildShapes> 10 10 </classShape> 11 <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds="9, 5.5, 2, 1. 3862939453125005">11 <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds="9, 5.5, 2, 1.9631982421874996"> 12 12 <DataClassMoniker Name="/HiveDataContext/Plugin" /> 13 13 <nestedChildShapes> 14 <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds="9.015, 5.9600000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />14 <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds="9.015, 5.9600000000000009, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> 15 15 </nestedChildShapes> 16 16 </classShape> … … 130 130 </nestedChildShapes> 131 131 </classShape> 132 <associationConnector edgePoints="[(11 : 6. 19314697265625); (11.625 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">132 <associationConnector edgePoints="[(11 : 6.28929768880208); (11.625 : 6.28929768880208)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 133 133 <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_PluginData" /> 134 134 <nodes> … … 144 144 </nodes> 145 145 </associationConnector> 146 <associationConnector edgePoints="[(9 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom=" NotFixed" fixedTo="NotFixed">146 <associationConnector edgePoints="[(9 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 147 147 <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" /> 148 148 <nodes> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs
r5375 r5402 361 361 private string _Version; 362 362 363 private bool _IsLocal; 364 365 private System.Guid _UserId; 366 367 private System.DateTime _DateCreated; 368 363 369 private EntitySet<RequiredPlugin> _RequiredPlugins; 364 370 … … 375 381 partial void OnVersionChanging(string value); 376 382 partial void OnVersionChanged(); 383 partial void OnIsLocalChanging(bool value); 384 partial void OnIsLocalChanged(); 385 partial void OnUserIdChanging(System.Guid value); 386 partial void OnUserIdChanged(); 387 partial void OnDateCreatedChanging(System.DateTime value); 388 partial void OnDateCreatedChanged(); 377 389 #endregion 378 390 … … 440 452 this.SendPropertyChanged("Version"); 441 453 this.OnVersionChanged(); 454 } 455 } 456 } 457 458 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsLocal", DbType="Bit")] 459 public bool IsLocal 460 { 461 get 462 { 463 return this._IsLocal; 464 } 465 set 466 { 467 if ((this._IsLocal != value)) 468 { 469 this.OnIsLocalChanging(value); 470 this.SendPropertyChanging(); 471 this._IsLocal = value; 472 this.SendPropertyChanged("IsLocal"); 473 this.OnIsLocalChanged(); 474 } 475 } 476 } 477 478 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier")] 479 public System.Guid UserId 480 { 481 get 482 { 483 return this._UserId; 484 } 485 set 486 { 487 if ((this._UserId != value)) 488 { 489 this.OnUserIdChanging(value); 490 this.SendPropertyChanging(); 491 this._UserId = value; 492 this.SendPropertyChanged("UserId"); 493 this.OnUserIdChanged(); 494 } 495 } 496 } 497 498 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCreated", DbType="DateTime")] 499 public System.DateTime DateCreated 500 { 501 get 502 { 503 return this._DateCreated; 504 } 505 set 506 { 507 if ((this._DateCreated != value)) 508 { 509 this.OnDateCreatedChanging(value); 510 this.SendPropertyChanging(); 511 this._DateCreated = value; 512 this.SendPropertyChanged("DateCreated"); 513 this.OnDateCreatedChanged(); 442 514 } 443 515 } … … 1835 1907 } 1836 1908 1837 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UptimeCalendarId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]1909 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UptimeCalendarId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier", IsPrimaryKey=true, IsDbGenerated=true)] 1838 1910 public System.Guid UptimeCalendarId 1839 1911 { … … 1855 1927 } 1856 1928 1857 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL")]1929 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier")] 1858 1930 public System.Guid ResourceId 1859 1931 { … … 1879 1951 } 1880 1952 1881 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime NOT NULL")]1953 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime")] 1882 1954 public System.DateTime StartDate 1883 1955 { … … 1899 1971 } 1900 1972 1901 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDate", DbType="DateTime NOT NULL")]1973 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDate", DbType="DateTime")] 1902 1974 public System.DateTime EndDate 1903 1975 { … … 1919 1991 } 1920 1992 1921 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AllDayEvent", DbType="Bit NOT NULL")]1993 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AllDayEvent", DbType="Bit")] 1922 1994 public bool AllDayEvent 1923 1995 { … … 1939 2011 } 1940 2012 1941 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Recurring", DbType="Bit NOT NULL")]2013 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Recurring", DbType="Bit")] 1942 2014 public bool Recurring 1943 2015 { … … 2422 2494 private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); 2423 2495 2496 private System.Guid _PluginDataId; 2497 2424 2498 private System.Guid _PluginId; 2425 2499 … … 2427 2501 2428 2502 private string _FileName; 2429 2430 private int _PluginDataId;2431 2503 2432 2504 private EntityRef<Plugin> _Plugin; … … 2436 2508 partial void OnValidate(System.Data.Linq.ChangeAction action); 2437 2509 partial void OnCreated(); 2510 partial void OnPluginDataIdChanging(System.Guid value); 2511 partial void OnPluginDataIdChanged(); 2438 2512 partial void OnPluginIdChanging(System.Guid value); 2439 2513 partial void OnPluginIdChanged(); … … 2442 2516 partial void OnFileNameChanging(string value); 2443 2517 partial void OnFileNameChanged(); 2444 partial void OnPluginDataIdChanging(int value);2445 partial void OnPluginDataIdChanged();2446 2518 #endregion 2447 2519 … … 2450 2522 this._Plugin = default(EntityRef<Plugin>); 2451 2523 OnCreated(); 2524 } 2525 2526 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PluginDataId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)] 2527 public System.Guid PluginDataId 2528 { 2529 get 2530 { 2531 return this._PluginDataId; 2532 } 2533 set 2534 { 2535 if ((this._PluginDataId != value)) 2536 { 2537 this.OnPluginDataIdChanging(value); 2538 this.SendPropertyChanging(); 2539 this._PluginDataId = value; 2540 this.SendPropertyChanged("PluginDataId"); 2541 this.OnPluginDataIdChanged(); 2542 } 2543 } 2452 2544 } 2453 2545 … … 2516 2608 } 2517 2609 2518 [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PluginDataId", AutoSync=AutoSync.OnInsert, DbType="Int IDENTITY(1,1)", IsPrimaryKey=true, IsDbGenerated=true)]2519 public int PluginDataId2520 {2521 get2522 {2523 return this._PluginDataId;2524 }2525 set2526 {2527 if ((this._PluginDataId != value))2528 {2529 this.OnPluginDataIdChanging(value);2530 this.SendPropertyChanging();2531 this._PluginDataId = value;2532 this.SendPropertyChanged("PluginDataId");2533 this.OnPluginDataIdChanged();2534 }2535 }2536 }2537 2538 2610 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Plugin_PluginData", Storage="_Plugin", ThisKey="PluginId", OtherKey="PluginId", IsForeignKey=true)] 2539 2611 public Plugin Plugin -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql
r5106 r5402 43 43 ALTER TABLE dbo.Plugin ALTER COLUMN PluginId ADD ROWGUIDCOL; 44 44 ALTER TABLE dbo.Plugin WITH NOCHECK ADD CONSTRAINT [DF_Plugin_PluginId] DEFAULT (newid()) FOR PluginId; 45 46 ALTER TABLE dbo.PluginData ALTER COLUMN PluginDataId ADD ROWGUIDCOL; 47 ALTER TABLE dbo.PluginData WITH NOCHECK ADD CONSTRAINT [DF_PluginData_PluginDataId] DEFAULT (newid()) FOR PluginDataId; 45 48 46 49 ALTER TABLE dbo.RequiredPlugins ALTER COLUMN RequiredPluginId ADD ROWGUIDCOL;
Note: See TracChangeset
for help on using the changeset viewer.