Author: antonello
Date: 2007-04-01 18:18:00 -0400 (Sun, 01 Apr 2007)
New Revision: 75273
Added:
trunk/olive/class/System.Data.Linq/System.Data.Linq/EntityRef.cs
Modified:
trunk/olive/class/System.Data.Linq/
trunk/olive/class/System.Data.Linq/System.Data.Linq.dll.sources
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlAssociationMapping.cs
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlColumnMapping.cs
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlMappingSource.cs
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlMemberMapping.cs
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlTableMapping.cs
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlTypeMapping.cs
Log:
Property changes on: trunk/olive/class/System.Data.Linq
___________________________________________________________________
Name: svn:ignore
- System.Data.Linq.csproj
System.Data.Linq.sln
bin
obj
System.Data.Linq.csproj.user
System.Data.Linq.suo
+ System.Data.Linq.csproj
System.Data.Linq.sln
bin
obj
System.Data.Linq.csproj.user
System.Data.Linq.suo
System
Properties
Added: trunk/olive/class/System.Data.Linq/System.Data.Linq/EntityRef.cs
===================================================================
--- trunk/olive/class/System.Data.Linq/System.Data.Linq/EntityRef.cs
2007-04-01 20:36:16 UTC (rev 75272)
+++ trunk/olive/class/System.Data.Linq/System.Data.Linq/EntityRef.cs
2007-04-01 22:18:00 UTC (rev 75273)
@@ -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 <[EMAIL PROTECTED]>
+//
+
+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
Modified:
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlAssociationMapping.cs
===================================================================
---
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlAssociationMapping.cs
2007-04-01 20:36:16 UTC (rev 75272)
+++
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlAssociationMapping.cs
2007-04-01 22:18:00 UTC (rev 75273)
@@ -1,4 +1,26 @@
-namespace System.Data.Linq
+// 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 <[EMAIL PROTECTED]>
+//
+
+namespace System.Data.Linq
{
class XmlAssociationMapping : XmlMemberMapping
{
Modified:
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlColumnMapping.cs
===================================================================
--- trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlColumnMapping.cs
2007-04-01 20:36:16 UTC (rev 75272)
+++ trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlColumnMapping.cs
2007-04-01 22:18:00 UTC (rev 75273)
@@ -1,4 +1,26 @@
-namespace System.Data.Linq
+// 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 <[EMAIL PROTECTED]>
+//
+
+namespace System.Data.Linq
{
class XmlColumnMapping : XmlMemberMapping
{
@@ -14,11 +36,67 @@
private bool? canBeNull;
private string dbType;
private string expression;
- private bool dBGenerated;
+ 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
}
}
\ No newline at end of file
Modified:
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlMappingSource.cs
===================================================================
--- trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlMappingSource.cs
2007-04-01 20:36:16 UTC (rev 75272)
+++ trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlMappingSource.cs
2007-04-01 22:18:00 UTC (rev 75273)
@@ -46,6 +46,21 @@
#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();
@@ -128,24 +143,8 @@
XmlTypeMapping typeMapping = new XmlTypeMapping(name);
typeMapping.InheritanceCode =
element.GetAttribute("InheritanceCode");
+ typeMapping.IsInheritanceDefault =
GetBoolean(element.GetAttribute("IsInheritanceDefault"), false);
- string inheritanceDefault =
element.GetAttribute("IsInheritanceDefault");
- if (inheritanceDefault == null)
- {
- typeMapping.IsInheritanceDefault = false;
- }
- else
- {
- try
- {
- typeMapping.IsInheritanceDefault =
Boolean.Parse(inheritanceDefault);
- }
- catch (FormatException)
- {
- throw new InvalidOperationException();
- }
- }
-
XmlNodeList childNodes = element.ChildNodes;
for (int i = 0; i < childNodes.Count; i++)
{
@@ -156,8 +155,10 @@
typeMapping.Derived.Add(ReadTypeElement(child));
break;
case "Association":
+ typeMapping.Members.Add(ReadAssociationElement(child));
break;
case "Column":
+ typeMapping.Members.Add(ReadColumnElement(child));
break;
default:
throw new InvalidOperationException();
@@ -166,6 +167,50 @@
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
Modified:
trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlMemberMapping.cs
===================================================================
--- trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlMemberMapping.cs
2007-04-01 20:36:16 UTC (rev 75272)
+++ trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlMemberMapping.cs
2007-04-01 22:18:00 UTC (rev 75273)
@@ -1,4 +1,26 @@
-namespace System.Data.Linq
+// 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 <[EMAIL PROTECTED]>
+//
+
+namespace System.Data.Linq
{
class XmlMemberMapping
{
Modified: trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlTableMapping.cs
===================================================================
--- trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlTableMapping.cs
2007-04-01 20:36:16 UTC (rev 75272)
+++ trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlTableMapping.cs
2007-04-01 22:18:00 UTC (rev 75273)
@@ -1,4 +1,26 @@
-namespace System.Data.Linq
+// 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 <[EMAIL PROTECTED]>
+//
+
+namespace System.Data.Linq
{
class XmlTableMapping
{
Modified: trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlTypeMapping.cs
===================================================================
--- trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlTypeMapping.cs
2007-04-01 20:36:16 UTC (rev 75272)
+++ trunk/olive/class/System.Data.Linq/System.Data.Linq/XmlTypeMapping.cs
2007-04-01 22:18:00 UTC (rev 75273)
@@ -1,5 +1,27 @@
-using System.Collections.Generic;
+// 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 <[EMAIL PROTECTED]>
+//
+using System.Collections.Generic;
+
namespace System.Data.Linq
{
class XmlTypeMapping
@@ -41,6 +63,11 @@
{
get { return derived; }
}
+
+ public List<XmlMemberMapping> Members
+ {
+ get { return members; }
+ }
#endregion
}
}
\ No newline at end of file
Modified: trunk/olive/class/System.Data.Linq/System.Data.Linq.dll.sources
===================================================================
--- trunk/olive/class/System.Data.Linq/System.Data.Linq.dll.sources
2007-04-01 20:36:16 UTC (rev 75272)
+++ trunk/olive/class/System.Data.Linq/System.Data.Linq.dll.sources
2007-04-01 22:18:00 UTC (rev 75273)
@@ -11,7 +11,9 @@
System.Data.Linq/DataAttribute.cs
System.Data.Linq/DatabaseAttribute.cs
System.Data.Linq/DataContext.cs
+System.Data.Linq/DataShape.cs
System.Data.Linq/DuplicateKeyException.cs
+System.Data.Linq/EntityRef.cs
Systen.Data.Linq/ForeignKeyReferenceAlreadyHasValueException.cs
System.Data.Linq/FunctionAttribute.cs
System.Data.Linq/ITable.cs
@@ -28,6 +30,13 @@
System.Data.Linq/Table_T.cs
System.Data.Linq/TableAttribute.cs
System.Data.Linq/UpdateCheck.cs
+System.Data.Linq/XmlAssociationMapping.cs
+System.Data.Linq/XmlColumnMapping.cs
+System.Data.Linq/XmlDatabaseMapping.cs
+System.Data.Linq/XmlMappingSource.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
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches