Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle 如何使用 Guid 映射 raw(16) #178

Closed
2881099 opened this issue Jan 6, 2020 · 0 comments
Closed

Oracle 如何使用 Guid 映射 raw(16) #178

2881099 opened this issue Jan 6, 2020 · 0 comments

Comments

@2881099
Copy link
Collaborator

2881099 commented Jan 6, 2020

1、单个指定映射

[Column(IsPrimary = true, DbType = "raw(16)", MapType = typeof(byte[]))]
public Guid ID { get; set; }

如果不指定 MapType 还是会默认映射 char(36)

2、统一映射处理

全局统一映射为 byte[] 方法,通过 Aop 拦截:

fsql.Aop.ConfigEntityProperty += new EventHandler<Aop.ConfigEntityPropertyEventArgs>((s, e) =>
{
    if (e.Property.PropertyType == typeof(Guid) || e.Property.PropertyType == typeof(Guid?))
    {
        e.ModifyResult.MapType = typeof(byte[]);
        e.ModifyResult.DbType = "raw(16)";
    }
});
@2881099 2881099 changed the title Oracle 如何使用 Guid 映射 raw(18) Oracle 如何使用 Guid 映射 raw(16) Jan 7, 2020
2881099 pushed a commit that referenced this issue Jan 8, 2020
@2881099 2881099 closed this as completed May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant