aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Nodes
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Nodes')
-rw-r--r--Prebuild/src/Core/Nodes/DatabaseProjectNode.cs188
-rw-r--r--Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs126
2 files changed, 157 insertions, 157 deletions
diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
index 8696a79..27c2051 100644
--- a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
+++ b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
@@ -1,94 +1,94 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Text; 4using System.Text;
5using System.Xml; 5using System.Xml;
6 6
7using Prebuild.Core.Attributes; 7using Prebuild.Core.Attributes;
8using Prebuild.Core.Interfaces; 8using Prebuild.Core.Interfaces;
9using Prebuild.Core.Utilities; 9using Prebuild.Core.Utilities;
10 10
11namespace Prebuild.Core.Nodes 11namespace Prebuild.Core.Nodes
12{ 12{
13 [DataNode("DatabaseProject")] 13 [DataNode("DatabaseProject")]
14 public class DatabaseProjectNode : DataNode 14 public class DatabaseProjectNode : DataNode
15 { 15 {
16 string name; 16 string name;
17 string path; 17 string path;
18 string fullpath; 18 string fullpath;
19 Guid guid = Guid.NewGuid(); 19 Guid guid = Guid.NewGuid();
20 readonly List<AuthorNode> authors = new List<AuthorNode>(); 20 readonly List<AuthorNode> authors = new List<AuthorNode>();
21 readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>(); 21 readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>();
22 22
23 public Guid Guid 23 public Guid Guid
24 { 24 {
25 get { return guid; } 25 get { return guid; }
26 } 26 }
27 27
28 public string Name 28 public string Name
29 { 29 {
30 get { return name; } 30 get { return name; }
31 } 31 }
32 32
33 public string Path 33 public string Path
34 { 34 {
35 get { return path; } 35 get { return path; }
36 } 36 }
37 37
38 public string FullPath 38 public string FullPath
39 { 39 {
40 get { return fullpath; } 40 get { return fullpath; }
41 } 41 }
42 42
43 public IEnumerable<DatabaseReferenceNode> References 43 public IEnumerable<DatabaseReferenceNode> References
44 { 44 {
45 get { return references; } 45 get { return references; }
46 } 46 }
47 47
48 public override void Parse(XmlNode node) 48 public override void Parse(XmlNode node)
49 { 49 {
50 name = Helper.AttributeValue(node, "name", name); 50 name = Helper.AttributeValue(node, "name", name);
51 path = Helper.AttributeValue(node, "path", name); 51 path = Helper.AttributeValue(node, "path", name);
52 52
53 try 53 try
54 { 54 {
55 fullpath = Helper.ResolvePath(path); 55 fullpath = Helper.ResolvePath(path);
56 } 56 }
57 catch 57 catch
58 { 58 {
59 throw new WarningException("Could not resolve Solution path: {0}", path); 59 throw new WarningException("Could not resolve Solution path: {0}", path);
60 } 60 }
61 61
62 Kernel.Instance.CurrentWorkingDirectory.Push(); 62 Kernel.Instance.CurrentWorkingDirectory.Push();
63 63
64 try 64 try
65 { 65 {
66 Helper.SetCurrentDir(fullpath); 66 Helper.SetCurrentDir(fullpath);
67 67
68 if (node == null) 68 if (node == null)
69 { 69 {
70 throw new ArgumentNullException("node"); 70 throw new ArgumentNullException("node");
71 } 71 }
72 72
73 foreach (XmlNode child in node.ChildNodes) 73 foreach (XmlNode child in node.ChildNodes)
74 { 74 {
75 IDataNode dataNode = Kernel.Instance.ParseNode(child, this); 75 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
76 76
77 if (dataNode == null) 77 if (dataNode == null)
78 continue; 78 continue;
79 79
80 if (dataNode is AuthorNode) 80 if (dataNode is AuthorNode)
81 authors.Add((AuthorNode)dataNode); 81 authors.Add((AuthorNode)dataNode);
82 else if (dataNode is DatabaseReferenceNode) 82 else if (dataNode is DatabaseReferenceNode)
83 references.Add((DatabaseReferenceNode)dataNode); 83 references.Add((DatabaseReferenceNode)dataNode);
84 } 84 }
85 } 85 }
86 finally 86 finally
87 { 87 {
88 Kernel.Instance.CurrentWorkingDirectory.Pop(); 88 Kernel.Instance.CurrentWorkingDirectory.Pop();
89 } 89 }
90 90
91 base.Parse(node); 91 base.Parse(node);
92 } 92 }
93 } 93 }
94} 94}
diff --git a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs
index 97c3964..845db24 100644
--- a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs
+++ b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs
@@ -1,63 +1,63 @@
1using System; 1using System;
2using Prebuild.Core.Attributes; 2using Prebuild.Core.Attributes;
3using Prebuild.Core.Utilities; 3using Prebuild.Core.Utilities;
4 4
5namespace Prebuild.Core.Nodes 5namespace Prebuild.Core.Nodes
6{ 6{
7 [DataNode("DatabaseReference")] 7 [DataNode("DatabaseReference")]
8 public class DatabaseReferenceNode : DataNode 8 public class DatabaseReferenceNode : DataNode
9 { 9 {
10 string name; 10 string name;
11 Guid providerId; 11 Guid providerId;
12 string connectionString; 12 string connectionString;
13 13
14 public string Name 14 public string Name
15 { 15 {
16 get { return name; } 16 get { return name; }
17 } 17 }
18 18
19 public Guid ProviderId 19 public Guid ProviderId
20 { 20 {
21 get { return providerId; } 21 get { return providerId; }
22 } 22 }
23 23
24 public string ConnectionString 24 public string ConnectionString
25 { 25 {
26 get { return connectionString; } 26 get { return connectionString; }
27 } 27 }
28 28
29 public override void Parse(System.Xml.XmlNode node) 29 public override void Parse(System.Xml.XmlNode node)
30 { 30 {
31 name = Helper.AttributeValue(node, "name", name); 31 name = Helper.AttributeValue(node, "name", name);
32 32
33 string providerName = Helper.AttributeValue(node, "providerName", string.Empty); 33 string providerName = Helper.AttributeValue(node, "providerName", string.Empty);
34 if (providerName != null) 34 if (providerName != null)
35 { 35 {
36 switch (providerName) 36 switch (providerName)
37 { 37 {
38 // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\* 38 // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
39 // Not sure if these will help other operating systems, or if there's a better way. 39 // Not sure if these will help other operating systems, or if there's a better way.
40 case "Microsoft.SqlServerCe.Client.3.5": 40 case "Microsoft.SqlServerCe.Client.3.5":
41 providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break; 41 providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break;
42 case "System.Data.OleDb": 42 case "System.Data.OleDb":
43 providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break; 43 providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break;
44 case "System.Data.OracleClient": 44 case "System.Data.OracleClient":
45 providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break; 45 providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break;
46 case "System.Data.SqlClient": 46 case "System.Data.SqlClient":
47 providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break; 47 providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break;
48 case "System.Data.Odbc": 48 case "System.Data.Odbc":
49 providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break; 49 providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break;
50 50
51 default: 51 default:
52 throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id."); 52 throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id.");
53 } 53 }
54 } 54 }
55 else 55 else
56 providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B"))); 56 providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
57 57
58 connectionString = Helper.AttributeValue(node, "connectionString", connectionString); 58 connectionString = Helper.AttributeValue(node, "connectionString", connectionString);
59 59
60 base.Parse(node); 60 base.Parse(node);
61 } 61 }
62 } 62 }
63} 63}