5 // Marek Habersack <grendel@twistedcode.net>
7 // Copyright (c) 2011 Novell, Inc
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 using System.Collections.Generic;
29 using System.Collections.ObjectModel;
30 using System.Data.Services.Common;
31 using System.Diagnostics;
32 using System.Linq.Expressions;
33 using System.Reflection;
35 using System.Runtime.CompilerServices;
37 namespace System.Data.Services.Providers
39 [DebuggerDisplay ("{Name}: {InstanceType}, {ResourceTypeKind}")]
40 public class ResourceType
44 public bool IsMediaLinkEntry {
45 get { throw new NotImplementedException (); }
46 set { throw new NotImplementedException (); }
49 public Type InstanceType {
53 public ResourceType BaseType {
57 public ResourceTypeKind ResourceTypeKind {
61 public ReadOnlyCollection <ResourceProperty> Properties {
62 get { throw new NotImplementedException (); }
65 public ReadOnlyCollection <ResourceProperty> PropertiesDeclaredOnThisType {
66 get { throw new NotImplementedException (); }
69 public ReadOnlyCollection <ResourceProperty> KeyProperties {
70 get { throw new NotImplementedException (); }
73 public ReadOnlyCollection <ResourceProperty> ETagProperties {
74 get { throw new NotImplementedException (); }
81 public string FullName {
85 public string Namespace {
87 if (nameSpace == null)
93 public bool IsAbstract {
97 public bool IsOpenType {
98 get { throw new NotImplementedException (); }
99 set { throw new NotImplementedException (); }
102 public bool CanReflectOnInstanceType {
106 public object CustomState {
107 get { throw new NotImplementedException (); }
108 set { throw new NotImplementedException (); }
111 public bool IsReadOnly {
115 public ResourceType (Type instanceType, ResourceTypeKind resourceTypeKind, ResourceType baseType, string namespaceName, string name, bool isAbstract)
117 if (instanceType == null)
118 throw new ArgumentNullException ("instanceType");
119 if (String.IsNullOrEmpty (name))
120 throw new ArgumentNullException ("name");
121 if (resourceTypeKind == ResourceTypeKind.Primitive)
122 throw new ArgumentException ("'Primitive' is not a valid value for resourceTypeKind", "resourceTypeKind");
123 if (instanceType.IsValueType)
124 throw new ArgumentException ("Clr type for the resource type cannot be a value type.");
126 this.InstanceType = instanceType;
127 this.ResourceTypeKind = resourceTypeKind;
128 this.BaseType = baseType;
129 if (String.IsNullOrEmpty (namespaceName))
130 this.FullName = name;
132 this.FullName = namespaceName + "." + name;
134 this.nameSpace = namespaceName;
135 this.IsAbstract = isAbstract;
137 // Appears to always be true
138 this.CanReflectOnInstanceType = true;
141 public static ResourceType GetPrimitiveResourceType (Type type)
143 throw new NotImplementedException ();
146 public void AddProperty (ResourceProperty property)
148 throw new NotImplementedException ();
151 public void AddEntityPropertyMappingAttribute (EntityPropertyMappingAttribute attribute)
153 throw new NotImplementedException ();
156 public void SetReadOnly ()
158 // TODO: anything else?
162 protected virtual IEnumerable <ResourceProperty> LoadPropertiesDeclaredOnThisType ()
164 throw new NotImplementedException ();