Moved to mainline.
authorMarek Safar <marek.safar@gmail.com>
Mon, 3 Mar 2008 10:54:27 +0000 (10:54 -0000)
committerMarek Safar <marek.safar@gmail.com>
Mon, 3 Mar 2008 10:54:27 +0000 (10:54 -0000)
svn path=/trunk/mcs/; revision=97176

64 files changed:
mcs/class/System.Data.Linq/Assembly/AssemblyInfo.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/Assembly/ChangeLog [new file with mode: 0644]
mcs/class/System.Data.Linq/ChangeLog [new file with mode: 0644]
mcs/class/System.Data.Linq/Makefile [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/AssociationAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/AttributeMappingSource.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/AutoSync.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ColumnAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/DataAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/DatabaseAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/FunctionAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/InheritanceMappingAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MappingSource.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaAccessor.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaAssociation.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaDataMember.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaFunction.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaFunctionType.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaModel.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaParameter.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaTable.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaType.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ParameterAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ProviderAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ResultTypeAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/TableAttribute.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/UpdateCheck.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Mapping/XmlMappingSource.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Provider/ICompiledQuery.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Provider/IDataServices.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Provider/IDeferredSourceFactory.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Provider/IExecuteResults.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Provider/IMultipleResults.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Provider/IProvider.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Provider/IQueryResults.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.Provider/IQueryResults_T.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.SqlClient/ChangeLog [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq.dll.sources [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/Binary.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/ChangeConflictCollection.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/ChangeConflictException.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/ChangeLog [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/CompiledQuery.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/ConflictMode.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/DataContext.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/DataShape.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/DuplicateKeyException.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/EntityRef.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/ForeignKeyReferenceAlreadyHasValueException.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/IExecuteResult.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/IMultipleResults.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/ITable.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/Link_T.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/MemberChangeConflict.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/ObjectChangeConflict.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/RefreshMode.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/Schema.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/Table_T.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/XmlAssociationMapping.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/XmlColumnMapping.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/XmlDatabaseMapping.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/XmlMemberMapping.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/XmlTableMapping.cs [new file with mode: 0644]
mcs/class/System.Data.Linq/System.Data.Linq/XmlTypeMapping.cs [new file with mode: 0644]

diff --git a/mcs/class/System.Data.Linq/Assembly/AssemblyInfo.cs b/mcs/class/System.Data.Linq/Assembly/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..4ead32a
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// AssemblyInfo.cs
+//
+// Authors:
+//     Antonello Provenzano  <antonello@deveel.com>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Resources;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("System.Data.Linq.dll")]
+[assembly: AssemblyDescription("System.Data.Linq.dll")]
+[assembly: AssemblyCompany("Mono Development Team")]
+[assembly: AssemblyProduct("System.Query")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyCulture("")]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: AssemblyInformationalVersion ("")]
+
+[assembly: CLSCompliant(true)]
+[assembly: ComVisible (false)]
+
+[assembly: AssemblyVersion(Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile("../ecma.pub")]
+[assembly: SecurityPermission (SecurityAction.RequestMinimum, SkipVerification=true)]
+[assembly: AllowPartiallyTrustedCallers]
+
diff --git a/mcs/class/System.Data.Linq/Assembly/ChangeLog b/mcs/class/System.Data.Linq/Assembly/ChangeLog
new file mode 100644 (file)
index 0000000..e0a6a17
--- /dev/null
@@ -0,0 +1,8 @@
+2007-08-23  Marek Safar <marek.safar@gmail.com>
+
+       * ChangeLog: Updated version info.
+       
+2007-03-23  Antonello Provenzano <antonello@deveel.com>
+
+       * ChangeLog: Added
+
diff --git a/mcs/class/System.Data.Linq/ChangeLog b/mcs/class/System.Data.Linq/ChangeLog
new file mode 100644 (file)
index 0000000..e159539
--- /dev/null
@@ -0,0 +1,13 @@
+2007-08-24  Marek Safar  <marek.safar@gmail.com>\r
+\r
+       * System.Data.Linq.dll.sources: Some Beta 2 updates.\r
+       \r
+       * Makefile: Build as 3.5 assembly.\r
+       \r
+2007-08-12  Marek Safar  <marek.safar@gmail.com>\r
+\r
+       * System.Data.Linq.dll.sources: Added missing files.\r
+       \r
+2007-03-24  Marek Safar  <marek.safar@gmail.com>\r
+\r
+       * Initial commit\r
diff --git a/mcs/class/System.Data.Linq/Makefile b/mcs/class/System.Data.Linq/Makefile
new file mode 100644 (file)
index 0000000..a05523b
--- /dev/null
@@ -0,0 +1,24 @@
+thisdir = class/System.Dat.Linq\r
+SUBDIRS = \r
+include ../../build/rules.make\r
+\r
+LIBRARY = System.Data.Linq.dll\r
+LIB_MCS_FLAGS = \\r
+                /r:System.dll \\r
+                /r:System.Core.dll \\r
+                /r:System.Data.dll \\r
+                /r:System.Transactions.dll \\r
+                /r:System.Xml.dll \\r
+\r
+NO_TEST = yes\r
+\r
+# This is a .NET 3.5 only assembly\r
+VALID_PROFILE := $(filter net_3_5, $(PROFILE))\r
+ifndef VALID_PROFILE\r
+LIBRARY_NAME = dummy-System.Data.Linq.dll\r
+NO_INSTALL = yes\r
+NO_SIGN_ASSEMBLY = yes\r
+NO_TEST = yes\r
+endif\r
+\r
+include ../../build/library.make\r
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/AssociationAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/AssociationAttribute.cs
new file mode 100644 (file)
index 0000000..c538e80
--- /dev/null
@@ -0,0 +1,77 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System;
+
+namespace System.Data.Linq.Mapping
+{
+    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
+    public sealed class AssociationAttribute : DataAttribute
+    {
+
+        #region Fields
+        private string deleteRule;
+        private bool fkey;
+        private bool unique;
+        private string otherKey;
+        private string thisKey;
+        bool deleteOnNull;
+        #endregion
+
+        #region Properties
+        public bool DeleteOnNull {
+               get { return deleteOnNull; }
+               set { deleteOnNull = value; }
+        }
+        
+        public string DeleteRule
+        {
+            get { return deleteRule; }
+            set { deleteRule = value; }
+        }
+
+        public bool IsForeignKey 
+        {
+            get { return fkey; }
+            set { fkey = value; }
+        }
+
+        public bool IsUnique
+        {
+            get { return this.unique; }
+            set { unique = value; }
+        }
+
+        public string OtherKey
+        {
+            get { return this.otherKey; }
+            set { otherKey = value; }
+        }
+
+        public string ThisKey
+        {
+            get { return thisKey; }
+            set { thisKey = value; }
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/AttributeMappingSource.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/AttributeMappingSource.cs
new file mode 100644 (file)
index 0000000..1a2107f
--- /dev/null
@@ -0,0 +1,32 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    public sealed class AttributeMappingSource : MappingSource
+    {
+        protected internal override MetaModel CreateModel(Type contextType)
+        {
+            throw new NotImplementedException ();
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/AutoSync.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/AutoSync.cs
new file mode 100644 (file)
index 0000000..b197657
--- /dev/null
@@ -0,0 +1,34 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//     Marek Safar <marek.safar@gmail.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    public enum AutoSync
+    {
+        Default                = 0,
+       Always          = 1,
+        Never          = 2,
+        OnInsert       = 3,
+        OnUpdate       = 4
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ColumnAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ColumnAttribute.cs
new file mode 100644 (file)
index 0000000..0782755
--- /dev/null
@@ -0,0 +1,108 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//      Antonello Provenzano  <antonello@deveel.com>
+//     Marek Safar <marek.safar@gmail.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
+    public sealed class ColumnAttribute : DataAttribute
+    {
+
+        #region Fields
+        private AutoSync autoSync = ~AutoSync.Never;
+        private bool canBeNull = true;
+        private bool canBeNullSet;
+        private UpdateCheck check = UpdateCheck.Always;
+        private string dbtype;
+        private string expression;
+        private bool dbGen;
+        private bool discrim;
+        private bool pkey;
+        private bool version;
+        #endregion
+
+        #region Properties
+        public AutoSync AutoSync
+        {
+            get { return autoSync; }
+            set { autoSync = value; }
+        }
+
+        public bool CanBeNull
+        {
+            get { return canBeNull; }
+            set
+            {
+                canBeNullSet = true;
+                canBeNull = value;
+            }
+        }
+
+        internal bool CanBeNullSet
+        {
+            get { return canBeNullSet; }
+        }
+
+        public string DbType
+        {
+            get { return dbtype; }
+            set { dbtype = value; }
+        }
+
+        public string Expression
+        {
+            get { return expression; }
+            set { expression = value; }
+        }
+
+        public bool IsDbGenerated
+        {
+            get { return dbGen; }
+            set { dbGen = value; }
+        }
+
+        public bool IsDiscriminator
+        {
+            get { return discrim; }
+            set { discrim = value; }
+        }
+
+        public bool IsPrimaryKey
+        {
+            get { return pkey; }
+            set { pkey = value; }
+        }
+
+        public bool IsVersion
+        {
+            get { return version; }
+            set { version = value; }
+        }
+
+        public UpdateCheck UpdateCheck
+        {
+            get { return check; }
+            set { check = value; }
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/DataAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/DataAttribute.cs
new file mode 100644 (file)
index 0000000..42884b3
--- /dev/null
@@ -0,0 +1,46 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class DataAttribute : Attribute
+    {
+        #region Fields
+        private string name;
+        private string storage;
+        #endregion
+
+        #region Properties
+        public string Name
+        {
+            get { return name; }
+            set { name = value; }
+        }
+
+        public string Storage
+        {
+            get { return storage; }
+            set { storage = value; }
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/DatabaseAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/DatabaseAttribute.cs
new file mode 100644 (file)
index 0000000..612db3d
--- /dev/null
@@ -0,0 +1,40 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
+    public sealed class DatabaseAttribute : Attribute
+    {
+        #region Fields
+        private string name;
+        #endregion
+
+        #region Properties
+        public string Name
+        {
+            get { return name; }
+            set { name = value; }
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/FunctionAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/FunctionAttribute.cs
new file mode 100644 (file)
index 0000000..328acb1
--- /dev/null
@@ -0,0 +1,48 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//      Antonello Provenzano  <antonello@deveel.com>
+//     Marek Safar <marek.safar@gmail.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
+    public sealed class FunctionAttribute : Attribute
+    {
+        #region Fields
+        string name;
+        bool is_composable;
+        #endregion
+
+        #region Properties
+        public string Name
+        {
+            get { return name; }
+            set { name = value; }
+        }
+        
+        public bool IsComposable {
+               get { return is_composable; }
+               set { is_composable = value; }
+        }
+        
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/InheritanceMappingAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/InheritanceMappingAttribute.cs
new file mode 100644 (file)
index 0000000..498f47a
--- /dev/null
@@ -0,0 +1,58 @@
+//
+// InheritanceMappingAttribute.cs
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace System.Data.Linq.Mapping
+{
+    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
+    public sealed class InheritanceMappingAttribute : Attribute
+    {
+        #region Fields
+       object code;
+       bool isDefault;
+       Type type;
+        #endregion
+
+        #region Properties
+        public object Code
+        {
+            get { return code; }
+            set { code = value; }
+        }
+        
+        public bool IsDefault {
+               get { return isDefault; }
+               set { isDefault = value; }
+        }
+        
+        public Type Type {
+               get { return type; }
+               set { type = value; }
+       }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MappingSource.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MappingSource.cs
new file mode 100644 (file)
index 0000000..956929c
--- /dev/null
@@ -0,0 +1,31 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class MappingSource
+    {
+        #region Protected Methods
+        protected internal abstract MetaModel CreateModel(Type contextType);
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaAccessor.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaAccessor.cs
new file mode 100644 (file)
index 0000000..2c245ec
--- /dev/null
@@ -0,0 +1,53 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class MetaAccessor
+    {
+        #region Properties
+        public abstract Type Type { get; }
+        #endregion
+
+        #region Public Methods
+        public abstract object GetBoxedValue(object instance);
+
+        public abstract void SetBoxedValue(ref object instance, object value);
+
+
+        public virtual bool HasAssignedValue(object instance)
+        {
+            return true;
+        }
+
+        public virtual bool HasLoadedValue(object instance)
+        {
+            return false;
+        }
+
+        public virtual bool HasValue(object instance)
+        {
+            return true;
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaAssociation.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaAssociation.cs
new file mode 100644 (file)
index 0000000..f9fd320
--- /dev/null
@@ -0,0 +1,56 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.ObjectModel;
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class MetaAssociation
+    {
+
+        #region Properties
+        public abstract string DeleteRule { get; }
+
+        public abstract bool IsForeignKey { get; }
+
+        public abstract bool IsMany { get; }
+
+        public abstract bool IsNullable { get; }
+
+        public abstract bool IsUnique { get; }
+
+        public abstract ReadOnlyCollection<MetaDataMember> OtherKey { get; }
+
+        public abstract bool OtherKeyIsPrimaryKey { get; }
+
+        public abstract MetaDataMember OtherMember { get; }
+
+        public abstract MetaType OtherType { get; }
+
+        public abstract ReadOnlyCollection<MetaDataMember> ThisKey { get; }
+
+        public abstract bool ThisKeyIsPrimaryKey { get; }
+
+        public abstract MetaDataMember ThisMember { get; }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaDataMember.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaDataMember.cs
new file mode 100644 (file)
index 0000000..1bdf397
--- /dev/null
@@ -0,0 +1,83 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Reflection;
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class MetaDataMember
+    {
+        #region Properties
+        public abstract MetaAssociation Association { get; }
+
+        public abstract AutoSync AutoSync { get; }
+
+        public abstract bool CanBeNull { get; }
+
+        public abstract string DbType { get; }
+
+        public abstract MetaAccessor DeferredSourceAccessor { get; }
+
+        public abstract MetaAccessor DeferredValueAccessor { get; }
+
+        public abstract string Expression { get; }
+
+        public abstract bool IsAssociation { get; }
+
+        public abstract bool IsDbGenerated { get; }
+
+        public abstract bool IsDeferred { get; }
+
+        public abstract bool IsDiscriminator { get; }
+
+        public abstract bool IsPersistent { get; }
+
+        public abstract bool IsPrimaryKey { get; }
+
+        public abstract bool IsVersion { get; }
+
+        public abstract string MappedName { get; }
+
+        public abstract MemberInfo Member { get; }
+
+        public abstract MetaAccessor MemberAccessor { get; }
+
+        public abstract MetaType DeclaringType { get; }
+
+        public abstract string Name { get; }
+
+        public abstract int Ordinal { get; }
+
+        public abstract MetaAccessor StorageAccessor { get; }
+
+        public abstract MemberInfo StorageMember { get; }
+
+        public abstract Type Type { get; }
+
+        public abstract UpdateCheck UpdateCheck { get; }
+        #endregion
+
+        #region Public Methods
+        public abstract bool IsDeclaredBy(MetaType type);
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaFunction.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaFunction.cs
new file mode 100644 (file)
index 0000000..e8170c7
--- /dev/null
@@ -0,0 +1,50 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class MetaFunction
+    {
+
+        #region Properties
+        public abstract bool HasMultipleResults { get; }
+
+        public abstract string MappedName { get; }
+
+        public abstract MethodInfo Method { get; }
+
+        public abstract MetaModel Model { get; }
+
+        public abstract string Name { get; }
+
+        public abstract ReadOnlyCollection<MetaParameter> Parameters { get; }
+
+        public abstract MetaParameter ReturnParameter { get; }
+
+        public abstract ReadOnlyCollection<MetaType> ResultRowTypes { get; }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaFunctionType.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaFunctionType.cs
new file mode 100644 (file)
index 0000000..faeb5a4
--- /dev/null
@@ -0,0 +1,32 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    public enum MetaFunctionType
+    {
+        Invalid,
+        StoredProcedure,
+        UserDefinedFunction,
+        TableValuedFunction
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaModel.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaModel.cs
new file mode 100644 (file)
index 0000000..9efb232
--- /dev/null
@@ -0,0 +1,49 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class MetaModel
+    {
+        #region Properties
+        public abstract string DatabaseName { get; }
+
+        public abstract Type ProviderType { get; }
+        #endregion
+
+
+        #region Public Methods
+        public abstract MetaFunction GetFunction(MethodInfo method);
+
+        public abstract IEnumerable<MetaFunction> GetFunctions();
+
+        public abstract MetaTable GetTable(Type rowType);
+
+        public abstract IEnumerable<MetaTable> GetTables();
+
+        public abstract MetaType GetMetaType(Type type);
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaParameter.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaParameter.cs
new file mode 100644 (file)
index 0000000..2e69594
--- /dev/null
@@ -0,0 +1,42 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Reflection;
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class MetaParameter
+    {
+
+        #region Properties
+        public abstract string DbType { get; }
+
+        public abstract string MappedName { get; }
+
+        public abstract string Name { get; }
+
+        public abstract ParameterInfo Parameter { get; }
+
+        public abstract Type ParameterType { get; }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaTable.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaTable.cs
new file mode 100644 (file)
index 0000000..7cecbd9
--- /dev/null
@@ -0,0 +1,35 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class MetaTable
+    {
+        #region Properties
+        public abstract MetaModel Model { get; }
+
+        public abstract MetaType RowType { get; }
+
+        public abstract string TableName { get; }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaType.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/MetaType.cs
new file mode 100644 (file)
index 0000000..86915af
--- /dev/null
@@ -0,0 +1,85 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Reflection;
+
+namespace System.Data.Linq.Mapping
+{
+    public abstract class MetaType
+    {
+        #region Public Methods
+        public abstract MetaDataMember GetDataMember(MemberInfo member);
+
+        public abstract MetaType GetInheritanceType(Type type);
+
+        public abstract MetaType GetTypeForInheritanceCode(object code);
+        #endregion
+
+        #region Properties
+        public abstract ReadOnlyCollection<MetaAssociation> Associations { get; }
+
+        public abstract bool CanInstantiate { get; }
+
+        public abstract ReadOnlyCollection<MetaDataMember> DataMembers { get; }
+
+        public abstract MetaDataMember DBGeneratedIdentityMember { get; }
+
+        public abstract ReadOnlyCollection<MetaType> DerivedTypes { get; }
+
+        public abstract MetaDataMember Discriminator { get; }
+
+        public abstract bool HasInheritance { get; }
+
+        public abstract bool HasInheritanceCode { get; }
+        
+        public abstract bool HasUpdateCheck { get; }
+
+        public abstract ReadOnlyCollection<MetaDataMember> IdentityMembers { get; }
+
+        public abstract object InheritanceCode { get; }
+
+        public abstract MetaType InheritanceDefault { get; }
+
+        public abstract MetaType InheritanceRoot { get; }
+
+        public abstract ReadOnlyCollection<MetaType> InheritanceTypes { get; }
+
+        public abstract bool IsEntity { get; }
+
+        public abstract bool IsInheritanceDefault { get; }
+
+        public abstract MetaModel Model { get; }
+
+        public abstract string Name { get; }
+
+        public abstract ReadOnlyCollection<MetaDataMember> PersistentDataMembers { get; }
+
+        public abstract MetaTable Table { get; }
+
+        public abstract Type Type { get; }
+
+        public abstract MetaDataMember VersionMember { get; }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ParameterAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ParameterAttribute.cs
new file mode 100644 (file)
index 0000000..71af9b3
--- /dev/null
@@ -0,0 +1,47 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter, AllowMultiple = false)]
+    public sealed class ParameterAttribute : Attribute
+    {
+        #region Fields
+        private string dbType;
+        private string name;
+        #endregion
+
+        #region Properties
+        public string DbType
+        {
+            get { return dbType; }
+            set { dbType = value; }
+        }
+
+        public string Name
+        {
+            get { return name; }
+            set { name = value; }
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ProviderAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ProviderAttribute.cs
new file mode 100644 (file)
index 0000000..e200a3e
--- /dev/null
@@ -0,0 +1,44 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
+    public sealed class ProviderAttribute : Attribute
+    {
+        public ProviderAttribute(Type type)
+        {
+            this.type = type;
+        }
+
+        #region Fields
+        private Type type;
+        #endregion
+
+        #region Properties
+        public Type Type
+        {
+            get { return type; }
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ResultTypeAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/ResultTypeAttribute.cs
new file mode 100644 (file)
index 0000000..c9d8ffa
--- /dev/null
@@ -0,0 +1,46 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+    public sealed class ResultTypeAttribute : Attribute
+    {
+        #region .ctor
+        public ResultTypeAttribute(Type type)
+        {
+            this.type = type;
+        }
+        #endregion
+
+        #region Fields
+        private Type type;
+        #endregion
+
+        #region Properties
+        public Type Type
+        {
+            get { return type; }
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/TableAttribute.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/TableAttribute.cs
new file mode 100644 (file)
index 0000000..c60f65c
--- /dev/null
@@ -0,0 +1,46 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
+    public sealed class TableAttribute : Attribute
+    {
+        #region .ctor
+        public TableAttribute()
+        {
+        }
+        #endregion
+
+        #region Fields
+        private string name;
+        #endregion
+
+        #region Properties
+        public string Name
+        {
+            get { return name; }
+            set { name = value; }
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/UpdateCheck.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/UpdateCheck.cs
new file mode 100644 (file)
index 0000000..bed12c1
--- /dev/null
@@ -0,0 +1,31 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Mapping
+{
+    public enum UpdateCheck
+    {
+        Always,
+        Never,
+        WhenChanged
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/XmlMappingSource.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Mapping/XmlMappingSource.cs
new file mode 100644 (file)
index 0000000..acb46fb
--- /dev/null
@@ -0,0 +1,268 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+using System.Data.Linq.Provider;
+using System.IO;
+using System.Xml;
+
+namespace System.Data.Linq.Mapping
+{
+    /// <summary>
+    /// A source that maps against an XML serialization of the
+    /// DLINQ Mapping Schema.
+    /// </summary>
+    public sealed class XmlMappingSource : MappingSource
+    {
+        #region .ctor
+        private XmlMappingSource(XmlDatabaseMapping dbMapping)
+        {
+            this.dbMapping = dbMapping;
+        }
+        #endregion
+
+        #region Fields
+        private XmlDatabaseMapping dbMapping;
+        private Dictionary<Type, MetaModel> models = new Dictionary<Type,MetaModel>();
+        #endregion
+
+        #region Private Static Methods
+        private static bool GetBoolean(string value, bool defaultValue)
+        {
+            if (value == null)
+                return defaultValue;
+
+            try
+            {
+                return Boolean.Parse(value);
+            }
+            catch (FormatException)
+            {
+                throw new InvalidOperationException();
+            }
+        }
+
+        private static XmlDatabaseMapping ReadDatabaseMapping(XmlReader reader)
+        {
+            XmlDocument doc = new XmlDocument();
+            doc.Load(reader);
+
+            XmlElement dbElement = doc.DocumentElement;
+            if (dbElement.LocalName != "Database")
+                throw new InvalidOperationException();
+
+            string name = dbElement.GetAttribute("Name");
+            if (name == null)
+                throw new InvalidOperationException();
+
+            string providerType = dbElement.GetAttribute("ProviderType");
+
+            XmlDatabaseMapping dbMapping = new XmlDatabaseMapping(name, providerType);
+
+            try
+            {
+                dbMapping = new XmlDatabaseMapping(name, providerType);
+
+                XmlNodeList childNodes = dbElement.ChildNodes;
+
+                for (int i = 0; i < childNodes.Count; i++)
+                {
+                    XmlElement child = childNodes[i] as XmlElement;
+                    switch (child.LocalName)
+                    {
+                        case "Table":
+                            dbMapping.Tables.Add(ReadTableElement(child));
+                            break;
+                        case "StoredProcedure":
+                            break;
+                        case "UserDefinedFunction":
+                            break;
+                        case "TableValuedFunction":
+                            break;
+                    }
+                }
+            }
+            catch
+            {
+                dbMapping = null;
+                throw;
+            }
+
+            return dbMapping;
+        }
+
+        private static XmlTableMapping ReadTableElement(XmlElement element)
+        {
+            string name = element.GetAttribute("name");
+            if (name == null || name.Length == 0)
+                throw new InvalidOperationException();
+
+            XmlTableMapping tableMapping = new XmlTableMapping(name);
+
+            XmlNodeList childNodes = element.ChildNodes;
+            for (int i = 0; i < childNodes.Count; i++)
+            {
+                XmlElement child = childNodes[i] as XmlElement;
+                if (child.LocalName != "Type") //ISSUE: should we ignore the case?
+                    throw new InvalidOperationException();
+
+                if (tableMapping.RowType != null)
+                    throw new InvalidOperationException();
+
+                tableMapping.RowType = ReadTypeElement(child);
+            }
+
+            return tableMapping;
+        }
+
+        private static XmlTypeMapping ReadTypeElement(XmlElement element)
+        {
+            string name = element.GetAttribute("Name");
+            if (name == null || name.Length == 0)
+                throw new InvalidOperationException();
+
+            XmlTypeMapping typeMapping = new XmlTypeMapping(name);
+
+            typeMapping.InheritanceCode = element.GetAttribute("InheritanceCode");
+            typeMapping.IsInheritanceDefault = GetBoolean(element.GetAttribute("IsInheritanceDefault"), false);
+
+            XmlNodeList childNodes = element.ChildNodes;
+            for (int i = 0; i < childNodes.Count; i++)
+            {
+                XmlElement child = childNodes[i] as XmlElement;
+                switch (child.LocalName)
+                {
+                    case "Type":
+                        typeMapping.Derived.Add(ReadTypeElement(child));
+                        break;
+                    case "Association":
+                        typeMapping.Members.Add(ReadAssociationElement(child));
+                        break;
+                    case "Column":
+                       throw new NotImplementedException ();
+                        //typeMapping.Members.Add(ReadColumnElement(child));
+                        break;
+                    default:
+                        throw new InvalidOperationException();
+                }
+            }
+
+            return typeMapping;
+        }
+
+        [MonoTODO]
+        private static XmlMemberMapping ReadAssociationElement(XmlElement element)
+        {
+            string member = element.GetAttribute("Member");
+            if (member == null || member.Length == 0)
+                throw new InvalidOperationException();
+
+            XmlAssociationMapping assMapping = new XmlAssociationMapping(member);
+
+            return assMapping;
+        }
+/*
+        private static XmlColumnMapping ReadColumnElement(XmlElement element)
+        {
+            string member = element.GetAttribute("Member");
+            if (member == null || member.Length == 0)
+                throw new InvalidOperationException();
+
+            XmlColumnMapping columnMapping = new XmlColumnMapping(member);
+            columnMapping.Name = element.GetAttribute("Name");
+            columnMapping.DbType = element.GetAttribute("DbType");
+            columnMapping.IsDBGenerated = GetBoolean(element.GetAttribute("IsDBGenerated"), false);
+            columnMapping.IsDiscriminator = GetBoolean(element.GetAttribute("IsDiscriminator"), false);
+            columnMapping.IsPrimaryKey = GetBoolean(element.GetAttribute("IsPrimaryKey"), false);
+            columnMapping.IsVersion = GetBoolean(element.GetAttribute("IsVersion"), false);
+            columnMapping.Storage = element.GetAttribute("Storage");
+            columnMapping.CanBeNull = GetBoolean(element.GetAttribute("CanBeNull"), false);
+            columnMapping.Expression = element.GetAttribute("Expression");
+
+            string sUpdateCheck = element.GetAttribute("UpdateCheck");
+            if (sUpdateCheck == null)
+                columnMapping.UpdateCheck = UpdateCheck.Always;
+            else
+                columnMapping.UpdateCheck = (UpdateCheck)Enum.Parse(typeof(UpdateCheck), sUpdateCheck, true);
+
+            string sAutoSync = element.GetAttribute("AutoSync");
+            if (sAutoSync == null)
+                columnMapping.AutoSync = AutoSync.Always;
+            else
+                columnMapping.AutoSync = (AutoSync)Enum.Parse(typeof(AutoSync), sAutoSync, true);
+
+            return columnMapping;
+        }
+        */
+        #endregion
+
+        #region Protected Methods
+        protected internal override MetaModel CreateModel(Type contextType)
+        {
+            if (contextType == null)
+                throw new ArgumentNullException("contextType");
+
+            MetaModel model = models[contextType];
+            if (model == null)
+            {
+                //TODO: we have to create it and add it to the dictionary...
+            }
+
+            return model;
+        }
+        #endregion
+
+        #region Public Static Methods
+        public static XmlMappingSource FromStream(Stream stream)
+        {
+            if (stream == null)
+                throw new ArgumentNullException("stream");
+
+            return FromReader(new XmlTextReader(stream));
+        }
+
+        public static XmlMappingSource FromReader(XmlReader reader)
+        {
+            if (reader == null)
+                throw new ArgumentNullException("reader");
+
+            return new XmlMappingSource(ReadDatabaseMapping(reader));
+        }
+
+        public static XmlMappingSource FromUrl(string url)
+        {
+            if (url == null)
+                throw new ArgumentNullException("url");
+
+            return FromReader(new XmlTextReader(url));
+        }
+
+        public static XmlMappingSource FromXml(string xml)
+        {
+            if (xml == null)
+                throw new ArgumentNullException("xml");
+
+            return FromReader(new XmlTextReader(new StringReader(xml)));
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Provider/ICompiledQuery.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Provider/ICompiledQuery.cs
new file mode 100644 (file)
index 0000000..0f4a061
--- /dev/null
@@ -0,0 +1,31 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Provider
+{
+    public interface ICompiledQuery
+    {
+        #region Methods
+        object Execute(IProvider provider, object[] arguments);
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IDataServices.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IDataServices.cs
new file mode 100644 (file)
index 0000000..04f8071
--- /dev/null
@@ -0,0 +1,68 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Linq;
+using System.Linq.Expressions;
+
+
+namespace System.Data.Linq.Provider
+{
+    public interface IDataServices
+    {/*
+        #region Properties
+        DataContext Context { get; }
+
+        MetaModel Model { get; }
+        #endregion
+
+        #region Methods
+        IQueryable CreateQuery(Type type, Expression expression);
+
+        object GetCachedObject(Expression query);
+
+        object GetCachedObject(MetaType type, object[] keyValues);
+
+        IQueryable GetDataMemberQuery(MetaDataMember member, Expression[] keyValues);
+
+        IQueryable GetDataMemberQuery(MetaDataMember member, object[] keyValues);
+
+        IDeferredSourceFactory GetDeferredSourceFactory(MetaDataMember member);
+
+        object[] GetForeignKeyValues(MetaAssociation association, object instance);
+
+        object[] GetKeyValues(MetaType type, LambdaExpression predicate);
+
+        object[] GetKeyValues(MetaType type, object instance);
+
+        IQueryable GetObjectQuery(MetaType type, Expression[] keyValues);
+
+        IQueryable GetObjectQuery(MetaType type, object[] keyValues);
+
+        object InsertLookupCachedObject(MetaType type, object instance);
+
+        bool IsCachedObject(MetaType type, object instance);
+
+        void OnEntityMaterialized(MetaType type, object instance);
+        #endregion
+        */
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IDeferredSourceFactory.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IDeferredSourceFactory.cs
new file mode 100644 (file)
index 0000000..31f51e2
--- /dev/null
@@ -0,0 +1,33 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections;
+
+namespace System.Data.Linq.Provider
+{
+    public interface IDeferredSourceFactory
+    {
+        IEnumerable CreateDeferredSource(object instance);
+
+        IEnumerable CreateDeferredSource(object[] keyValues);
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IExecuteResults.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IExecuteResults.cs
new file mode 100644 (file)
index 0000000..100a278
--- /dev/null
@@ -0,0 +1,35 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq.Provider
+{
+    public interface IExecuteResults
+    {
+        #region Properties
+        object ReturnValue { get; }
+        #endregion
+
+        #region Methods
+        object GetParameterValue(int parameterIndex);
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IMultipleResults.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IMultipleResults.cs
new file mode 100644 (file)
index 0000000..099d7d7
--- /dev/null
@@ -0,0 +1,33 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+
+namespace System.Data.Linq.Provider
+{
+    public interface IMultipleResults : IExecuteResults, IDisposable
+    {
+        #region Methods
+        IEnumerable<T> GetResult<T>();
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IProvider.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IProvider.cs
new file mode 100644 (file)
index 0000000..a25cd56
--- /dev/null
@@ -0,0 +1,64 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections;
+using System.Data;
+using System.IO;
+using System.Linq.Expressions;
+
+namespace System.Data.Linq.Provider
+{
+    public interface IProvider : IDisposable
+    {
+        #region Properties
+        IDbConnection Connection { get; }
+
+        TextWriter Log { get; set; }
+
+        IDbTransaction Transaction { get; set; }
+        #endregion
+
+        #region Methods
+        void ClearConnection();
+
+        ICompiledQuery Compile(Expression query);
+
+        void CreateDatabase();
+
+        bool DatabaseExists();
+
+        void DeleteDatabase();
+
+        IMultipleResults ExecuteMultipleResults(Expression query);
+
+        IExecuteResult ExecuteNonQuery(Expression query);
+
+        IQueryResults ExecuteQuery(Expression query);
+
+        string GetQueryText(Expression query);
+
+        void Initialize(IDataServices dataServices, object connection);
+
+        IEnumerator Translate(Type elementType, IDataReader reader);
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IQueryResults.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IQueryResults.cs
new file mode 100644 (file)
index 0000000..e863576
--- /dev/null
@@ -0,0 +1,30 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections;
+
+namespace System.Data.Linq.Provider
+{
+    public interface IQueryResults : IExecuteResult, IEnumerable
+    {
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IQueryResults_T.cs b/mcs/class/System.Data.Linq/System.Data.Linq.Provider/IQueryResults_T.cs
new file mode 100644 (file)
index 0000000..54bc996
--- /dev/null
@@ -0,0 +1,30 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+
+namespace System.Data.Linq.Provider
+{
+    public interface IQueryResults<T> : IQueryResults, IEnumerable<T>
+    {
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.SqlClient/ChangeLog b/mcs/class/System.Data.Linq/System.Data.Linq.SqlClient/ChangeLog
new file mode 100644 (file)
index 0000000..ab546e1
--- /dev/null
@@ -0,0 +1,3 @@
+2007-09-12  Marek Safar  <marek.safar@gmail.com>
+
+       * Initial commit
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq.dll.sources b/mcs/class/System.Data.Linq/System.Data.Linq.dll.sources
new file mode 100644 (file)
index 0000000..0f9934b
--- /dev/null
@@ -0,0 +1,58 @@
+../../build/common/Consts.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+System.Data.Linq/Binary.cs
+System.Data.Linq/ChangeConflictCollection.cs
+System.Data.Linq/ChangeConflictException.cs
+System.Data.Linq/ConflictMode.cs
+System.Data.Linq/DataContext.cs
+System.Data.Linq/DataShape.cs
+System.Data.Linq/DuplicateKeyException.cs
+System.Data.Linq/EntityRef.cs
+System.Data.Linq/ForeignKeyReferenceAlreadyHasValueException.cs
+System.Data.Linq/IExecuteResult.cs
+System.Data.Linq/IMultipleResults.cs
+System.Data.Linq/ITable.cs
+System.Data.Linq/Link_T.cs
+System.Data.Linq/MemberChangeConflict.cs
+System.Data.Linq/ObjectChangeConflict.cs
+System.Data.Linq/RefreshMode.cs
+System.Data.Linq/Schema.cs
+System.Data.Linq/Table_T.cs
+System.Data.Linq/XmlAssociationMapping.cs
+System.Data.Linq/XmlColumnMapping.cs
+System.Data.Linq/XmlDatabaseMapping.cs
+System.Data.Linq/XmlMemberMapping.cs
+System.Data.Linq/XmlTableMapping.cs
+System.Data.Linq/XmlTypeMapping.cs
+System.Data.Linq.Provider/ICompiledQuery.cs
+System.Data.Linq.Provider/IDataServices.cs
+System.Data.Linq.Provider/IDeferredSourceFactory.cs
+System.Data.Linq.Provider/IQueryResults.cs
+System.Data.Linq.Provider/IQueryResults_T.cs
+System.Data.Linq.Provider/IProvider.cs
+System.Data.Linq.Mapping/AssociationAttribute.cs
+System.Data.Linq.Mapping/AttributeMappingSource.cs
+System.Data.Linq.Mapping/AutoSync.cs
+System.Data.Linq.Mapping/ColumnAttribute.cs
+System.Data.Linq.Mapping/DataAttribute.cs
+System.Data.Linq.Mapping/DatabaseAttribute.cs
+System.Data.Linq.Mapping/FunctionAttribute.cs
+System.Data.Linq.Mapping/InheritanceMappingAttribute.cs
+System.Data.Linq.Mapping/MappingSource.cs
+System.Data.Linq.Mapping/MetaAccessor.cs
+System.Data.Linq.Mapping/MetaAssociation.cs
+System.Data.Linq.Mapping/MetaFunction.cs
+System.Data.Linq.Mapping/MetaModel.cs
+System.Data.Linq.Mapping/MetaTable.cs
+System.Data.Linq.Mapping/MetaType.cs
+System.Data.Linq.Mapping/MetaDataMember.cs
+System.Data.Linq.Mapping/MetaFunctionType.cs
+System.Data.Linq.Mapping/MetaParameter.cs
+System.Data.Linq.Mapping/ParameterAttribute.cs
+System.Data.Linq.Mapping/ProviderAttribute.cs
+System.Data.Linq.Mapping/ResultTypeAttribute.cs
+System.Data.Linq.Mapping/TableAttribute.cs
+System.Data.Linq.Mapping/UpdateCheck.cs
+System.Data.Linq.Mapping/XmlMappingSource.cs
+
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/Binary.cs b/mcs/class/System.Data.Linq/System.Data.Linq/Binary.cs
new file mode 100644 (file)
index 0000000..e5072d3
--- /dev/null
@@ -0,0 +1,146 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.IO;
+
+namespace System.Data.Linq
+{
+    public sealed class Binary : IEquatable<Binary>
+    {
+        #region .ctor
+        public Binary(byte[] bytes, int offset, int length)
+        {
+        }
+
+        public Binary(byte[] bytes)
+            : this(bytes, true)
+        {
+        }
+
+        public Binary(byte[] bytes, bool copy)
+        {
+            if (bytes == null)
+                throw new ArgumentNullException("bytes");
+
+            if (copy)
+            {
+                this.bytes = new byte[bytes.Length];
+                Array.Copy(bytes, this.bytes, bytes.Length);
+            }
+            else
+            {
+                this.bytes = bytes;
+            }
+        }
+        #endregion
+
+        #region Fields
+        private byte[] bytes;
+
+        private static Binary emptyBin;
+        #endregion
+
+        #region Properties
+        public int Length
+        {
+            get { return bytes.Length; }
+        }
+
+        public byte this[int index]
+        {
+            get { return bytes[index]; }
+        }
+
+        public static Binary Empty
+        {
+            get
+            {
+                if (emptyBin == null)
+                    emptyBin = new Binary(new byte[0], 0, 0);
+                return emptyBin;
+            }
+        }
+        #endregion
+
+        #region Operators
+        public static bool operator ==(Binary binary1, Binary binary2)
+        {
+            if (binary1 == null && binary2 == null)
+                return true;
+            if (binary1 == null && binary2 != null)
+                return false;
+            return binary1.Equals(binary2);
+        }
+
+        public static bool operator !=(Binary binary1, Binary binary2)
+        {
+            return !(binary1 == binary2);
+        }
+
+        public static implicit operator Binary(byte[] bytes)
+        {
+            return new Binary(bytes);
+        }
+        #endregion
+
+        #region Public Methods
+
+        public bool Equals(Binary other)
+        {
+            return Equals(other);
+        }
+
+        public override bool Equals(object obj)
+        {
+            //TODO:
+            return base.Equals(obj);
+        }
+
+        public override int GetHashCode()
+        {
+            //TODO:
+            return base.GetHashCode();
+        }
+
+        public void CopyTo(int position, byte[] buffer, int offset, int length)
+        {
+            Array.Copy(this.bytes, position, buffer, offset, length);
+        }
+
+        public byte[] ToArray()
+        {
+            return (byte[])bytes.Clone();
+        }
+
+        public Stream ToStream()
+        {
+            return new MemoryStream(bytes, false);
+        }
+
+        public override string ToString()
+        {
+            //TODO:
+            return base.ToString();
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/ChangeConflictCollection.cs b/mcs/class/System.Data.Linq/System.Data.Linq/ChangeConflictCollection.cs
new file mode 100644 (file)
index 0000000..3f6d5d0
--- /dev/null
@@ -0,0 +1,100 @@
+using System.Collections;
+using System.Collections.Generic;
+
+namespace System.Data.Linq
+{
+    public sealed class ChangeConflictCollection : ICollection<ObjectChangeConflict>, ICollection
+    {
+        #region .ctor
+        internal ChangeConflictCollection()
+        {
+            list = new List<ObjectChangeConflict>();
+        }
+        #endregion
+
+        #region Fields
+        private List<ObjectChangeConflict> list;
+        #endregion
+
+        #region Properties
+
+        public int Count
+        {
+            get { return list.Count; }
+        }
+
+        public ObjectChangeConflict this[int index]
+        {
+            get { return list[index]; }
+        }
+
+        #endregion
+
+        #region ICollection<ObjectChangeConflict> Implementations
+        bool ICollection<ObjectChangeConflict>.IsReadOnly
+        {
+            get { return true; }
+        }
+
+        void ICollection<ObjectChangeConflict>.Add(ObjectChangeConflict item)
+        {
+            throw new NotSupportedException();
+        }
+
+        void ICollection.CopyTo(Array array, int index)
+        {
+            CopyTo((ObjectChangeConflict[])array, index);
+        }
+        #endregion
+
+        #region IEnumerable Implementations
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return list.GetEnumerator();
+        }
+
+        #endregion
+
+        #region ICollection Implementations
+        bool ICollection.IsSynchronized
+        {
+            get { return false; }
+        }
+
+        object ICollection.SyncRoot
+        {
+            get { return null; }
+        }
+        #endregion
+
+        #region Public Methods
+
+        public void Clear()
+        {
+            list.Clear();
+        }
+
+        public bool Contains(ObjectChangeConflict item)
+        {
+            return list.Contains(item);
+        }
+
+        public void CopyTo(ObjectChangeConflict[] array, int arrayIndex)
+        {
+            list.CopyTo(array, arrayIndex);
+        }
+
+        public bool Remove(ObjectChangeConflict item)
+        {
+            return list.Remove(item);
+        }
+
+        public IEnumerator<ObjectChangeConflict> GetEnumerator()
+        {
+            return list.GetEnumerator();
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/ChangeConflictException.cs b/mcs/class/System.Data.Linq/System.Data.Linq/ChangeConflictException.cs
new file mode 100644 (file)
index 0000000..163e606
--- /dev/null
@@ -0,0 +1,19 @@
+namespace System.Data.Linq
+{
+    public class ChangeConflictException : Exception
+    {
+        public ChangeConflictException()
+        {
+        }
+
+        public ChangeConflictException(string message)
+            : base(message)
+        {
+        }
+
+        public ChangeConflictException(string message, Exception innerException)
+            : base(message, innerException)
+        {
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/ChangeLog b/mcs/class/System.Data.Linq/System.Data.Linq/ChangeLog
new file mode 100644 (file)
index 0000000..b35feb0
--- /dev/null
@@ -0,0 +1,13 @@
+2007-08-24  Marek Safar  <marek.safar@gmail.com>
+
+       * *.cs: Some Beta 2 updates.
+
+2007-03-29  Antonello Provenzano  <antonello@deveel.com>
+
+       * DataContext.cs: implementations
+       * DataShape.cs: New file
+       * IDataServices.cs: New file
+       
+2007-03-24  Antonello Provenzano  <antonello@deveel.com>
+
+       * Initial commit
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/CompiledQuery.cs b/mcs/class/System.Data.Linq/System.Data.Linq/CompiledQuery.cs
new file mode 100644 (file)
index 0000000..d0b360a
--- /dev/null
@@ -0,0 +1,61 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Linq;
+using System.Linq.Expressions;
+
+namespace System.Data.Linq
+{
+    public sealed class CompiledQuery
+    {
+        #region Fields
+        private LambdaExpression expression;
+        #endregion
+
+        #region Properties
+        public LambdaExpression Expression
+        {
+            get { return expression; }
+        }
+        #endregion
+
+        public static Func<TArg0, TResult> Compile<TArg0, TResult>(Expression<Func<TArg0, TResult>> query) where TArg0 : DataContext
+        {
+            throw new NotImplementedException();
+        }
+
+        public static Func<TArg0, TArg1, TResult> Compile<TArg0, TArg1, TResult>(Expression<Func<TArg0, TArg1, TResult>> query) where TArg0 : DataContext
+        {
+            throw new NotImplementedException();
+        }
+
+        public static Func<TArg0, TArg1, TArg2, TResult> Compile<TArg0, TArg1, TArg2, TResult>(Expression<Func<TArg0, TArg1, TArg2, TResult>> query) where TArg0 : DataContext
+        {
+            throw new NotImplementedException();
+        }
+
+        public static Func<TArg0, TArg1, TArg2, TArg3, TResult> Compile<TArg0, TArg1, TArg2, TArg3, TResult>(Expression<Func<TArg0, TArg1, TArg2, TArg3, TResult>> query) where TArg0 : DataContext
+        {
+            throw new NotImplementedException();
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/ConflictMode.cs b/mcs/class/System.Data.Linq/System.Data.Linq/ConflictMode.cs
new file mode 100644 (file)
index 0000000..4280919
--- /dev/null
@@ -0,0 +1,30 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{
+    public enum ConflictMode
+    {
+        FailOnFirstConflict,
+        ContinueOnConflict
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/DataContext.cs b/mcs/class/System.Data.Linq/System.Data.Linq/DataContext.cs
new file mode 100644 (file)
index 0000000..7254440
--- /dev/null
@@ -0,0 +1,202 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Data.Linq.Mapping;
+using System.Data.Linq.Provider;
+using System.IO;
+using System.Linq;
+
+namespace System.Data.Linq
+{
+    public class DataContext : IDisposable
+    {
+        #region .ctor
+        public DataContext(IDbConnection connection, MappingSource mapping)
+        {
+            if (connection == null)
+                throw new ArgumentNullException("connection");
+            if (connection == null)
+                throw new ArgumentNullException("mapping");
+
+            this.conflicts = new ChangeConflictCollection();
+            this.mapping = mapping;
+
+            //TODO: init the IDataServices for the provider...
+
+            MetaModel model = mapping.CreateModel(GetType());
+            Type providerType = model.ProviderType;
+
+            if (providerType == null)
+                throw new InvalidOperationException();
+            if (!typeof(IProvider).IsAssignableFrom(providerType))
+                throw new InvalidOperationException();
+
+            provider = (IProvider)Activator.CreateInstance(providerType, true);
+            provider.Initialize(services, connection);
+        }
+
+        public DataContext(IDbConnection connection)
+            : this(connection, new AttributeMappingSource())
+        {
+        }
+
+        ~DataContext()
+        {
+            Dispose(false);
+        }
+        #endregion
+
+        #region Fields
+        private bool disposed;
+        private IProvider provider;
+        private MappingSource mapping;
+        private bool objectTracking;
+        private bool deferredLoading;
+        private DataShape shape;
+        private IDataServices services;
+        private ChangeConflictCollection conflicts;
+        #endregion
+
+        #region Properties
+
+        public ChangeConflictCollection ChangeConflicts
+        {
+            get
+            {
+                CheckIsDisposed();
+                return conflicts;
+            }
+        }
+
+        public IDbConnection Connection
+        {
+            get
+            {
+                CheckIsDisposed();
+                return provider.Connection;
+            }
+        }
+
+        public TextWriter Log
+        {
+            get
+            {
+                CheckIsDisposed();
+                return provider.Log;
+            }
+            set
+            {
+                CheckIsDisposed();
+                provider.Log = value;
+            }
+        }
+
+        public bool ObjectTrackingEnabled
+        {
+            get
+            {
+                CheckIsDisposed();
+                return objectTracking;
+            }
+            set
+            {
+                CheckIsDisposed();
+                objectTracking = value;
+                if (!value)
+                    deferredLoading = false;
+            }
+        }
+        #endregion
+
+        #region Private Methods
+        private void CheckIsDisposed()
+        {
+            if (disposed)
+                throw new ObjectDisposedException(GetType().Name);
+        }
+        #endregion
+
+        #region Protected Methods
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                if (provider != null)
+                {
+                    provider.Dispose();
+                    provider = null;
+                }
+                mapping = null;
+                shape = null;
+            }
+        }
+        #endregion
+
+        #region Public Methods
+        public void CreateDatabase()
+        {
+            CheckIsDisposed();
+            provider.CreateDatabase();
+        }
+
+        public bool DatabaseExists()
+        {
+            CheckIsDisposed();
+            return provider.DatabaseExists();
+        }
+
+        public void DeleteDatabase()
+        {
+            CheckIsDisposed();
+            provider.DeleteDatabase();
+        }
+
+        public void Dispose()
+        {
+            this.disposed = true;
+            this.Dispose(true);
+        }
+
+        public string GetQueryText(IQueryable query)
+        {
+            CheckIsDisposed();
+            if (query == null)
+                throw new ArgumentNullException("query");
+
+            return provider.GetQueryText(query.Expression);
+        }
+
+        public IEnumerable<T> Translate<T>(IDataReader reader)
+        {
+            CheckIsDisposed();
+            if (reader == null)
+                throw new ArgumentNullException("reader");
+
+            IEnumerator en = provider.Translate(typeof(T), reader);
+            while (en.MoveNext())
+                yield return (T)en.Current;
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/DataShape.cs b/mcs/class/System.Data.Linq/System.Data.Linq/DataShape.cs
new file mode 100644 (file)
index 0000000..c40aad1
--- /dev/null
@@ -0,0 +1,28 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{
+    public sealed class DataShape
+    {
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/DuplicateKeyException.cs b/mcs/class/System.Data.Linq/System.Data.Linq/DuplicateKeyException.cs
new file mode 100644 (file)
index 0000000..264187c
--- /dev/null
@@ -0,0 +1,43 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{
+    public class DuplicateKeyException : InvalidOperationException
+    {
+        #region .ctor
+        public DuplicateKeyException()
+        {
+        }
+
+        public DuplicateKeyException(string message)
+            : base(message)
+        {
+        }
+
+        public DuplicateKeyException(string message, Exception innerException)
+            : base(message, innerException)
+        {
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/EntityRef.cs b/mcs/class/System.Data.Linq/System.Data.Linq/EntityRef.cs
new file mode 100644 (file)
index 0000000..aa29c20
--- /dev/null
@@ -0,0 +1,70 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+
+namespace System.Data.Linq
+{
+    //TODO: this should be checked: is LINQ working to handle this?
+    public struct EntityRef<TEntity> where TEntity : class
+    {
+        #region .ctor
+        [MonoTODO()]
+        public EntityRef(TEntity entity)
+        {
+            this.source = null; //TODO: we should assign it...
+            this.entity = entity;
+        }
+
+        public EntityRef(IEnumerable<TEntity> source)
+        {
+            this.source = source;
+            entity = default(TEntity);
+        }
+
+        public EntityRef(EntityRef<TEntity> entityRef)
+        {
+            source = entityRef.source;
+            entity = entityRef.entity;
+        }
+        #endregion
+
+        #region Fields
+        private IEnumerable<TEntity> source;
+        private TEntity entity;
+        #endregion
+
+        #region Properties
+        public TEntity Entity
+        {
+            get { return entity; }
+            set { entity = value; }
+        }
+
+        [MonoTODO()]
+        public bool HasLoadedOrAssignedValue
+        {
+            get { return true; }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/ForeignKeyReferenceAlreadyHasValueException.cs b/mcs/class/System.Data.Linq/System.Data.Linq/ForeignKeyReferenceAlreadyHasValueException.cs
new file mode 100644 (file)
index 0000000..9990353
--- /dev/null
@@ -0,0 +1,41 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{
+    public class ForeignKeyReferenceAlreadyHasValueException : InvalidOperationException
+    {
+        public ForeignKeyReferenceAlreadyHasValueException()
+        {
+        }
+
+        public ForeignKeyReferenceAlreadyHasValueException(string message)
+            : base(message)
+        {
+        }
+
+        public ForeignKeyReferenceAlreadyHasValueException(string message, Exception innerException)
+            : base(message, innerException)
+        {
+        }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/IExecuteResult.cs b/mcs/class/System.Data.Linq/System.Data.Linq/IExecuteResult.cs
new file mode 100644 (file)
index 0000000..456b051
--- /dev/null
@@ -0,0 +1,35 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{
+    public interface IExecuteResult
+    {
+        #region Properties
+        object ReturnValue { get; }
+        #endregion
+
+        #region Methods
+        object GetParameterValue(int parameterIndex);
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/IMultipleResults.cs b/mcs/class/System.Data.Linq/System.Data.Linq/IMultipleResults.cs
new file mode 100644 (file)
index 0000000..fe39867
--- /dev/null
@@ -0,0 +1,33 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+
+namespace System.Data.Linq
+{
+    public interface IMultipleResults : IDisposable
+    {
+        #region Methods
+        IEnumerable<TElement> GetResult<TElement>();
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/ITable.cs b/mcs/class/System.Data.Linq/System.Data.Linq/ITable.cs
new file mode 100644 (file)
index 0000000..2c2b724
--- /dev/null
@@ -0,0 +1,36 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections;
+using System.Linq;
+
+namespace System.Data.Linq
+{
+    public interface ITable : IQueryable, IEnumerable
+    {
+        DataContext Context { get; }
+
+        string Name { get; }
+
+        Type RowType { get; }
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/Link_T.cs b/mcs/class/System.Data.Linq/System.Data.Linq/Link_T.cs
new file mode 100644 (file)
index 0000000..577624d
--- /dev/null
@@ -0,0 +1,94 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+
+namespace System.Data.Linq
+{
+    public struct Link<T>
+    {
+        #region .ctor
+        public Link(T value)
+        {
+            this.value = value;
+            source = null;
+        }
+
+        internal Link(IEnumerable<T> source)
+        {
+            this.source = source;
+            this.value = default(T);
+        }
+
+        internal Link(Link<T> link)
+        {
+            value = link.value;
+            source = link.source;
+        }
+        #endregion
+
+        #region Fields
+        private T value;
+        private IEnumerable<T> source;
+        #endregion
+
+        #region Properties
+        //TODO:
+        public bool HasValue
+        {
+            get { return true; }
+        }
+
+        public T Value
+        {
+            get { return value; }
+            set { this.value = value; }
+        }
+
+        internal bool HasLoadedValue
+        {
+            get { return false; }
+        }
+
+        internal bool HasAssignedValue
+        {
+            get { return false; }
+        }
+
+        internal T UnderlyingValue
+        {
+            get { return value; }
+        }
+
+        internal IEnumerable<T> Source
+        {
+            get { return source; }
+        }
+
+        //TODO:
+        internal bool HasSource
+        {
+            get { return false; }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/MemberChangeConflict.cs b/mcs/class/System.Data.Linq/System.Data.Linq/MemberChangeConflict.cs
new file mode 100644 (file)
index 0000000..2865463
--- /dev/null
@@ -0,0 +1,93 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Reflection;
+
+namespace System.Data.Linq
+{
+    public sealed class MemberChangeConflict
+    {
+        #region .ctor
+        internal MemberChangeConflict()
+        {
+        }
+        #endregion
+
+        #region Fields
+        private object currentValue;
+        private object databaseValue;
+        private bool resolved;
+        private bool modified;
+        private object originalValue;
+        #endregion
+
+        #region Properties
+        //TODO:
+        public object CurrentValue
+        {
+            get { return currentValue; }
+        }
+
+        //TODO:
+        public object DatabaseValue
+        {
+            get { return databaseValue; }
+        }
+
+        //TODO:
+        public bool IsModified
+        {
+            get { return modified; }
+        }
+
+        //TODO:
+        public bool IsResolved
+        {
+            get { return resolved; }
+        }
+
+        //TODO:
+        public MemberInfo Member
+        {
+            get { return null; }
+        }
+
+        //TODO:
+        public object OriginalValue
+        {
+            get { return originalValue; }
+        }
+        #endregion
+
+        #region Public Methods
+        public void Resolve(RefreshMode refreshMode)
+        {
+            //TODO:
+        }
+
+        public void Resolve(object value)
+        {
+            //TODO:
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/ObjectChangeConflict.cs b/mcs/class/System.Data.Linq/System.Data.Linq/ObjectChangeConflict.cs
new file mode 100644 (file)
index 0000000..c17faf8
--- /dev/null
@@ -0,0 +1,84 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.ObjectModel;
+
+namespace System.Data.Linq
+{
+    public sealed class ObjectChangeConflict
+    {
+        #region Fields
+        private bool deleted;
+        private bool resolved;
+        #endregion
+
+        #region Properties
+        //TODO:
+        public bool IsDeleted
+        {
+            get { return deleted; }
+        }
+
+        //TODO:
+        public bool IsResolved
+        {
+            get { return resolved; }
+        }
+
+        //TODO:
+        public ReadOnlyCollection<MemberChangeConflict> MemberConflicts
+        {
+            get { return null; }
+        }
+
+        //TODO:
+        public object Object
+        {
+            get { return null; }
+        }
+
+        //TODO:
+        public ITable Table
+        {
+            get { return null; }
+        }
+        #endregion
+
+        #region Public Methods
+        public void Resolve()
+        {
+            //TODO: check this...
+            Resolve(RefreshMode.KeepCurrentValues, true);
+        }
+
+        public void Resolve(RefreshMode refreshMode)
+        {
+            Resolve(refreshMode, false);
+        }
+
+        public void Resolve(RefreshMode refreshMode, bool autoResolveDeletes)
+        {
+            //TODO:
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/RefreshMode.cs b/mcs/class/System.Data.Linq/System.Data.Linq/RefreshMode.cs
new file mode 100644 (file)
index 0000000..573eec3
--- /dev/null
@@ -0,0 +1,31 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{
+    public enum RefreshMode
+    {
+        KeepCurrentValues,
+        KeepChanges,
+        OverwriteCurrentValues
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/Schema.cs b/mcs/class/System.Data.Linq/System.Data.Linq/Schema.cs
new file mode 100644 (file)
index 0000000..417d0a2
--- /dev/null
@@ -0,0 +1,68 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Data.Linq.Provider;
+using System.Reflection;
+
+namespace System.Data.Linq
+{
+    public abstract class Schema
+    {
+        protected Schema(DataContext context)
+        {
+            if (context == null)
+                throw new ArgumentNullException("context");
+            this.context = context;
+        }
+
+        #region Fields
+        private DataContext context;
+        #endregion
+
+        #region Properties
+        public DataContext Context
+        {
+            get { return context; }
+        }
+        #endregion
+
+        #region Protected Methods
+        protected IExecuteResult ExecuteMethodCall(object instance, MethodInfo methodInfo, params object[] parameters)
+        {
+            //TODO:
+            throw new NotImplementedException();
+        }
+
+        protected IQueryResults<T> ExecuteMethodCall<T>(object instance, MethodInfo methodInfo, params object[] parameters)
+        {
+            //TODO:
+            throw new NotImplementedException();
+        }
+
+        protected IMultipleResults ExecuteMethodCallWithMultipleResults(object instance, MethodInfo methodInfo, params object[] parameters)
+        {
+            //TODO:
+            throw new NotImplementedException();
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/Table_T.cs b/mcs/class/System.Data.Linq/System.Data.Linq/Table_T.cs
new file mode 100644 (file)
index 0000000..76b88cf
--- /dev/null
@@ -0,0 +1,148 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data.Linq.Mapping;
+using System.Linq;
+using System.Linq.Expressions;
+
+namespace System.Data.Linq
+{
+    public sealed class Table<T> : IQueryable<T>, IEnumerable<T>, ITable, IQueryable, IEnumerable, IListSource
+    {
+        #region .ctor
+        public Table(DataContext context, MetaTable metaTable)
+        {
+            this.context = context;
+            this.metaTable = metaTable;
+        }
+        #endregion
+
+        #region Fields
+        private DataContext context;
+        private MetaTable metaTable;
+        #endregion
+
+        #region Properties
+        public DataContext Context
+        {
+            get { return context; }
+        }
+
+        //TODO:
+        public bool IsReadOnly
+        {
+            get { return false; }
+        }
+
+        //TODO: check this... is this right?
+        public string Name {
+            get { return metaTable.TableName; }
+        }
+
+        //TODO: check this... is this right?
+        public Type RowType
+        {
+            get { return typeof(T); }
+        }
+        #endregion
+
+        #region IListSource Implementations
+        bool IListSource.ContainsListCollection 
+        {
+            get { return false; }
+        }
+
+        IList IListSource.GetList()
+        {
+            //TODO:
+            throw new NotImplementedException();
+        }
+        #endregion
+
+        #region IQueryable Implementations
+        //TODO: check this... is this right?
+        Type IQueryable.ElementType
+        {
+            get { return typeof(T); }
+        }
+
+        //TODO:
+        Expression IQueryable.Expression
+        {
+            get { return null; }
+        }
+        
+       public IQueryProvider Provider {
+               get {
+                       throw new NotImplementedException ();
+               }
+       }        
+        #endregion
+
+        #region ICollection Implementations
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return this.GetEnumerator();
+        }
+        #endregion
+
+        #region Public Methods
+        public void Add(T item)
+        {
+            //TODO:
+            throw new NotImplementedException();
+        }
+
+        public void Attach(T item)
+        {
+            //TODO:
+            throw new NotImplementedException();
+        }
+
+        public IEnumerator<T> GetEnumerator()
+        {
+            //TODO:
+            throw new NotImplementedException();
+        }
+
+        public void Remove(T item)
+        {
+            //TODO:
+            throw new NotImplementedException();
+        }
+
+        public void RemoveAll(IEnumerable<T> items)
+        {
+            //TODO:
+            throw new NotImplementedException();
+        }
+
+        public override string ToString()
+        {
+            return Name;
+        }
+        #endregion
+    }
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/XmlAssociationMapping.cs b/mcs/class/System.Data.Linq/System.Data.Linq/XmlAssociationMapping.cs
new file mode 100644 (file)
index 0000000..dfc3995
--- /dev/null
@@ -0,0 +1,81 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{
+    class XmlAssociationMapping : XmlMemberMapping
+    {
+        #region .ctor
+        public XmlAssociationMapping(string member)
+            : base(member)
+        {
+        }
+        #endregion
+
+        #region Fields
+        private string deleteRule;
+        private bool foreignKey;
+        private bool unique;
+        private string otherKey;
+        private string otherTableName;
+        private string thisKey;
+        #endregion
+
+        #region Properties
+        public string DeleteRule
+        {
+            get { return deleteRule; }
+            set { deleteRule = value; }
+        }
+
+        public bool IsForeignKey
+        {
+            get { return foreignKey; }
+            set { foreignKey = value; }
+        }
+
+        public bool IsUnique
+        {
+            get { return unique; }
+            set { unique = value; }
+        }
+
+        public string OtherKey
+        {
+            get { return otherKey; }
+            set { otherKey = value; }
+        }
+
+        public string OtherTableName
+        {
+            get { return otherTableName; }
+            set { otherTableName = value; }
+        }
+
+        public string ThisKey
+        {
+            get { return thisKey; }
+            set { thisKey = value; }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/XmlColumnMapping.cs b/mcs/class/System.Data.Linq/System.Data.Linq/XmlColumnMapping.cs
new file mode 100644 (file)
index 0000000..b9e5eff
--- /dev/null
@@ -0,0 +1,103 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{/*
+    class XmlColumnMapping : XmlMemberMapping
+    {
+        #region .ctor
+        public XmlColumnMapping(string member)
+            : base(member)
+        {
+        }
+        #endregion
+
+        #region Fields
+        private AutoSync autoSync;
+        private bool? canBeNull;
+        private string dbType;
+        private string expression;
+        private bool dbGenerated;
+        private bool discriminator;
+        private bool primaryKey;
+        private bool version;
+        private UpdateCheck updateCheck;
+        #endregion
+
+        #region Properties
+        public AutoSync AutoSync
+        {
+            get { return autoSync; }
+            set { autoSync = value; }
+        }
+
+        public bool? CanBeNull
+        {
+            get { return canBeNull; }
+            set { canBeNull = value; }
+        }
+
+        public string DbType
+        {
+            get { return dbType; }
+            set { dbType = value; }
+        }
+
+        public string Expression
+        {
+            get { return expression; }
+            set { expression = value; }
+        }
+
+        public bool IsDBGenerated
+        {
+            get { return dbGenerated; }
+            set { dbGenerated = value; }
+        }
+
+        public bool IsDiscriminator
+        {
+            get { return discriminator; }
+            set { discriminator = value; }
+        }
+
+        public bool IsPrimaryKey 
+        {
+            get { return primaryKey; }
+            set { primaryKey = value; }
+        }
+
+        public bool IsVersion
+        {
+            get { return version; }
+            set { version = value; }
+        }
+
+        public UpdateCheck UpdateCheck
+        {
+            get { return updateCheck; }
+            set { updateCheck = value; }
+        }
+        #endregion
+    }
+    */
+}
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/XmlDatabaseMapping.cs b/mcs/class/System.Data.Linq/System.Data.Linq/XmlDatabaseMapping.cs
new file mode 100644 (file)
index 0000000..09f9c25
--- /dev/null
@@ -0,0 +1,64 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+
+namespace System.Data.Linq
+{
+    /// <summary>
+    /// A class that represents the element "Database" in the
+    /// XML schema of a map to a database.
+    /// </summary>
+    class XmlDatabaseMapping
+    {
+        #region .ctor
+        public XmlDatabaseMapping(string name, string providerType)
+        {
+            this.name = name;
+            this.providerType = providerType;
+        }
+        #endregion
+
+        #region Fields
+        private string name;
+        private string providerType;
+        private List<XmlTableMapping> tables;
+        #endregion
+
+        #region Properties
+        public string Name
+        {
+            get { return name; }
+        }
+
+        public string ProviderType
+        {
+            get { return providerType; }
+        }
+
+        public List<XmlTableMapping> Tables
+        {
+            get { return tables; }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/XmlMemberMapping.cs b/mcs/class/System.Data.Linq/System.Data.Linq/XmlMemberMapping.cs
new file mode 100644 (file)
index 0000000..0a71302
--- /dev/null
@@ -0,0 +1,59 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{
+    class XmlMemberMapping
+    {
+        #region .ctor
+        protected XmlMemberMapping(string member)
+        {
+            this.member = member;
+        }
+        #endregion
+
+        #region Fields
+        private string member;
+        private string name;
+        private string storage;
+        #endregion
+
+        #region Properties
+        public string MemberName
+        {
+            get { return member; }
+        }
+
+        public string Name
+        {
+            get { return name; }
+            set { name = value; }
+        }
+
+        public string Storage
+        {
+            get { return storage; }
+            set { storage = value; }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/XmlTableMapping.cs b/mcs/class/System.Data.Linq/System.Data.Linq/XmlTableMapping.cs
new file mode 100644 (file)
index 0000000..7004d19
--- /dev/null
@@ -0,0 +1,52 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+namespace System.Data.Linq
+{
+    class XmlTableMapping
+    {
+        #region .ctor
+        public XmlTableMapping(string name)
+        {
+            this.name = name;
+        }
+        #endregion
+
+        #region Fields
+        private string name;
+        private XmlTypeMapping rowType;
+        #endregion
+
+        #region Properties
+        public string Name
+        {
+            get { return name; }
+        }
+
+        public XmlTypeMapping RowType
+        {
+            get { return rowType; }
+            set { rowType = value; }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/mcs/class/System.Data.Linq/System.Data.Linq/XmlTypeMapping.cs b/mcs/class/System.Data.Linq/System.Data.Linq/XmlTypeMapping.cs
new file mode 100644 (file)
index 0000000..07aae63
--- /dev/null
@@ -0,0 +1,73 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+//
+// Authors:
+//        Antonello Provenzano  <antonello@deveel.com>
+//
+
+using System.Collections.Generic;
+
+namespace System.Data.Linq
+{
+    class XmlTypeMapping
+    {
+        #region .ctor
+        public XmlTypeMapping(string name)
+        {
+            this.name = name;
+        }
+        #endregion
+
+        #region Fields
+        private string name;
+        private string inheritanceCode;
+        private bool inheritanceDefault;
+        private List<XmlTypeMapping> derived = new List<XmlTypeMapping>();
+        private List<XmlMemberMapping> members = new List<XmlMemberMapping>();
+        #endregion
+
+        #region Properties
+        public string TypeName
+        {
+            get { return name; }
+        }
+
+        public string InheritanceCode
+        {
+            get { return inheritanceCode; }
+            set { inheritanceCode = value; }
+        }
+
+        public bool IsInheritanceDefault
+        {
+            get { return inheritanceDefault; }
+            set { inheritanceDefault = value; }
+        }
+
+        public List<XmlTypeMapping> Derived
+        {
+            get { return derived; }
+        }
+
+        public List<XmlMemberMapping> Members
+        {
+            get { return members; }
+        }
+        #endregion
+    }
+}
\ No newline at end of file