5 // Copyright (c) 2007-2008 Jiri Moudry, Pascal Craponne
\r
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
\r
8 // of this software and associated documentation files (the "Software"), to deal
\r
9 // in the Software without restriction, including without limitation the rights
\r
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
11 // copies of the Software, and to permit persons to whom the Software is
\r
12 // furnished to do so, subject to the following conditions:
\r
14 // The above copyright notice and this permission notice shall be included in
\r
15 // all copies or substantial portions of the Software.
\r
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
28 using System.Collections.Generic;
\r
29 using System.Data.Linq.Mapping;
\r
30 using System.Reflection;
\r
32 using DbLinq.Data.Linq.Sugar.Expressions;
\r
35 using System.Data.Linq;
\r
37 using DbLinq.Data.Linq;
\r
40 namespace DbLinq.Data.Linq.Sugar
\r
42 internal interface IDataMapper
\r
45 /// Returns a table given a type, or null if the type is not mapped
\r
47 /// <param name="tableType"></param>
\r
48 /// <param name="dataContext"></param>
\r
49 /// <returns></returns>
\r
50 string GetTableName(Type tableType, DataContext dataContext);
\r
53 /// Returns a column name, provided its table and memberInfo
\r
55 /// <param name="tableExpression"></param>
\r
56 /// <param name="memberInfo"></param>
\r
57 /// <param name="dataContext"></param>
\r
58 /// <returns></returns>
\r
59 string GetColumnName(TableExpression tableExpression, MemberInfo memberInfo, DataContext dataContext);
\r
62 /// Returns a column name, provided its table type and memberInfo
\r
64 /// <param name="tableType"></param>
\r
65 /// <param name="memberInfo"></param>
\r
66 /// <param name="dataContext"></param>
\r
67 /// <returns></returns>
\r
68 string GetColumnName(Type tableType, MemberInfo memberInfo, DataContext dataContext);
\r
73 /// <param name="tableExpression"></param>
\r
74 /// <param name="dataContext"></param>
\r
75 /// <returns></returns>
\r
76 IList<MemberInfo> GetPrimaryKeys(TableExpression tableExpression, DataContext dataContext);
\r
81 /// <param name="tableDescription"></param>
\r
82 /// <returns></returns>
\r
83 IList<MemberInfo> GetPrimaryKeys(MetaTable tableDescription);
\r
86 /// Lists table mapped columns
\r
88 /// <param name="tableDescription"></param>
\r
89 /// <returns></returns>
\r
90 IList<MemberInfo> GetColumns(MetaTable tableDescription);
\r
93 /// Returns child associations (EntitySets)
\r
95 /// <param name="type"></param>
\r
96 /// <returns></returns>
\r
97 IList<MemberInfo> GetEntitySetAssociations(Type type);
\r
100 /// Returns parent associations (EntityRef)
\r
102 /// <param name="type"></param>
\r
103 /// <returns></returns>
\r
104 IList<MemberInfo> GetEntityRefAssociations(Type type);
\r
107 /// Returns association definition, if any
\r
109 /// <param name="thisTableExpression">The table referenced by the assocation (the type holding the member)</param>
\r
110 /// <param name="memberInfo">The memberInfo related to association</param>
\r
111 /// <param name="otherType"></param>
\r
112 /// <param name="otherKey">The keys in the associated table</param>
\r
113 /// <param name="joinType"></param>
\r
114 /// <param name="joinID"></param>
\r
115 /// <param name="dataContext"></param>
\r
116 /// <returns>ThisKey</returns>
\r
117 IList<MemberInfo> GetAssociation(TableExpression thisTableExpression, MemberInfo memberInfo, Type otherType, out IList<MemberInfo> otherKey, out TableJoinType joinType, out string joinID, DataContext dataContext);
\r