Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
88cf0b92
E
et
项目概览
guo450212436
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
et
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
88cf0b92
编写于
9月 15, 2017
作者:
T
tanghai
提交者:
GitHub
9月 15, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9 from northroom/master
修复mongo.bson 在iOS下的AOT问题
上级
89fc27b0
8d72ffa9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
1 deletion
+39
-1
Unity/Assets/Plugins/MongoDB/MongoDB.Bson/Serialization/BsonClassMap.cs
...lugins/MongoDB/MongoDB.Bson/Serialization/BsonClassMap.cs
+5
-1
Unity/Assets/Plugins/MongoDB/MongoDB.Bson/Serialization/BsonMemberMap.cs
...ugins/MongoDB/MongoDB.Bson/Serialization/BsonMemberMap.cs
+26
-0
Unity/Assets/Scripts/Base/Object/Entity.cs
Unity/Assets/Scripts/Base/Object/Entity.cs
+8
-0
未找到文件。
Unity/Assets/Plugins/MongoDB/MongoDB.Bson/Serialization/BsonClassMap.cs
浏览文件 @
88cf0b92
...
...
@@ -1274,9 +1274,12 @@ namespace MongoDB.Bson.Serialization
Expression
body
;
var
bindingFlags
=
BindingFlags
.
Public
|
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
;
var
classTypeInfo
=
_classType
.
GetTypeInfo
();
var
defaultConstructor
=
classTypeInfo
.
GetConstructors
(
bindingFlags
)
ConstructorInfo
defaultConstructor
=
classTypeInfo
.
GetConstructors
(
bindingFlags
)
.
Where
(
c
=>
c
.
GetParameters
().
Length
==
0
)
.
SingleOrDefault
();
#
if
AOT
_creator
=
()
=>
defaultConstructor
.
Invoke
(
null
);
#
else
if
(
defaultConstructor
!=
null
)
{
// lambdaExpression = () => (object) new TClass()
...
...
@@ -1295,6 +1298,7 @@ namespace MongoDB.Bson.Serialization
var
lambdaExpression
=
Expression
.
Lambda
<
Func
<
object
>>(
body
);
_creator
=
lambdaExpression
.
Compile
();
#
endif
}
return
_creator
;
}
...
...
Unity/Assets/Plugins/MongoDB/MongoDB.Bson/Serialization/BsonMemberMap.cs
浏览文件 @
88cf0b92
...
...
@@ -598,6 +598,24 @@ namespace MongoDB.Bson.Serialization
private
Func
<
object
,
object
>
GetGetter
()
{
#
if
AOT
PropertyInfo
propertyInfo
=
_memberInfo
as
PropertyInfo
;
if
(
propertyInfo
!=
null
)
{
MethodInfo
getMethodInfo
=
propertyInfo
.
GetGetMethod
();
if
(
getMethodInfo
==
null
)
{
var
message
=
string
.
Format
(
"The property '{0} {1}' of class '{2}' has no 'get' accessor."
,
propertyInfo
.
PropertyType
.
FullName
,
propertyInfo
.
Name
,
propertyInfo
.
DeclaringType
.
FullName
);
throw
new
BsonSerializationException
(
message
);
}
return
(
obj
)
=>
{
return
getMethodInfo
.
Invoke
(
obj
,
null
);
};
}
FieldInfo
fieldInfo
=
_memberInfo
as
FieldInfo
;
return
(
obj
)
=>
{
return
fieldInfo
.
GetValue
(
obj
);
};
#
else
var
propertyInfo
=
_memberInfo
as
PropertyInfo
;
if
(
propertyInfo
!=
null
)
{
...
...
@@ -625,10 +643,17 @@ namespace MongoDB.Bson.Serialization
);
return
lambdaExpression
.
Compile
();
#
endif
}
private
Action
<
object
,
object
>
GetPropertySetter
()
{
#
if
AOT
var
propertyInfo
=
(
PropertyInfo
)
_memberInfo
;
return
(
obj
,
value
)
=>
{
propertyInfo
.
SetValue
(
obj
,
value
);
};
#
else
var
propertyInfo
=
(
PropertyInfo
)
_memberInfo
;
var
setMethodInfo
=
propertyInfo
.
SetMethod
;
if
(
IsReadOnly
)
...
...
@@ -653,6 +678,7 @@ namespace MongoDB.Bson.Serialization
);
return
lambdaExpression
.
Compile
();
#
endif
}
private
void
ThrowFrozenException
()
...
...
Unity/Assets/Scripts/Base/Object/Entity.cs
浏览文件 @
88cf0b92
...
...
@@ -211,5 +211,13 @@ namespace Model
}
}
}
#
if
AOT
private
void
AvoidAot
()
{
EnumSerializer
<
EntityType
>
e
=
new
EnumSerializer
<
EntityType
>();
}
#
endif
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录