Comments (7)
Because of the issue with fluent-nhibernate, it seems joined-subclass
mapping is not supported by FluentNHibernate now.
- Create all mappings for all classes, include
NHibernate.AspNetCore.Identity
's classes , please refer to the exists hbm mappings; - Just use
*.hbm.xml
files , don't use FluentHiberate; - Use NHibernate.Mapping.Attributes, it support
joined-subclass
mapping with the existing hbm xml mapping , which I have tested with it before。
Personaly, I prefer to use xml mapping (*.hbm.xml), because both
FluentHiberate
andNHibernate.Mapping.Attributes
will translate it's mapping to xml mapping at runtime. And with the help of NHibernate's xml schema (nhibernate-configuration.xsd and nhibernate-mapping.xsd) file, editing hbm file with intelli popup is easy too.
For more details, please refer to issue #10 .
from nhibernate.aspnetcore.identity.
@beginor have you tried using Nhibernate.Mapping.ByCode? Have the "root entity for AppRole was never registered" MappingException even when using JoinedSubclassMapping. Would love a confirmation or a way around it.
from nhibernate.aspnetcore.identity.
@marcelNgan I have already developed fluent-mapping for identity. You can find it in this repo.
@beginor , if you want I can create PR for it in here.
from nhibernate.aspnetcore.identity.
@Elvin1492 Thanks, but I do not use fluent-mapping
because of #13 (comment)
from nhibernate.aspnetcore.identity.
@marcelNgan I will try using this library with NHibernate.Mapping.ByCode
, But I think it should be the same as NHibernate.Mapping.Attributes
, which I had test before.
from nhibernate.aspnetcore.identity.
@marcelNgan If you are using with NHibernate.Mapping.ByCode
, please start with rewriting of AppRole.hbm.xml
and like this :
using NHibernate;
using NHibernate.Type;
using NHibernate.Mapping.ByCode.Conformist;
using NHIdentityRole = NHibernate.AspNetCore.Identity.IdentityRole;
namespace WebTest.Entities {
public class AppRoleMapping : JoinedSubclassMapping<AppRole> {
public AppRoleMapping() {
// Add NHIdentityRole as root entity first
ExplicitDeclarationsHolder.AddAsRootEntity(typeof(NHIdentityRole));
Extends(typeof(NHIdentityRole));
Schema("public");
Table("app_roles");
Key(k => k.Column("id"));
Property(
p => p.Description,
maping => {
maping.Column("description");
maping.Type(NHibernateUtil.String);
maping.Length(256);
}
);
}
}
}
Then compile the mapping and add them after AddIdentityMappings
in Startup.cs
var cfg = new Configuration();
var file = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"hibernate.config"
);
cfg.Configure(file);
// Add identity mapping based on dialect config (dialet must contains
// PostgreSQL, MySQL or MsSql)
cfg.AddIdentityMappings();
// cfg.AddAssembly(typeof(Startup).Assembly);
var modelMapper = new NHibernate.Mapping.ByCode.ModelMapper();
modelMapper.AddMapping<AppRoleMapping>();
modelMapper.AddMapping<AppUserMapping>();
modelMapper.AddMapping<TodoItemMapping>();
var mappings = modelMapper.CompileMappingForAllExplicitlyAddedEntities();
cfg.AddMapping(mappings);
from nhibernate.aspnetcore.identity.
@Elvin1492 I think the project offluent-mapping
is obsoleted, does not have any update for more then one year.
if you are interested in using of NHibernate.Mapping.ByCode
, please keep track of #16 , I will refact to use NHibernate.Mapping.ByCode
.
from nhibernate.aspnetcore.identity.
Related Issues (20)
- readme and sample usage HOT 2
- Issues getting started HOT 5
- UpperCase of role's id HOT 1
- The mapping of concurrencyStamp looks invalid HOT 5
- map ConcurrencyStamp of IdentityUser and IdentityRole as version HOT 1
- SqlException: Incorrect syntax near the keyword 'public'. HOT 8
- Refact to use NHibernate.Mapping.ByCode HOT 2
- Create User - Row was updated or deleted by another transaction HOT 9
- Correct way using of UserManager HOT 6
- implement user only store HOT 1
- Make id property type configurable HOT 4
- Table names in mapping does not match table names in SQL scripts HOT 3
- Error while creating new user in PostgreSQL HOT 4
- Wrong mapping table IdentityUserClaim. True value is AspNetUserClaims HOT 5
- Oracle Error Identifier is too long HOT 6
- ConfigurationExtensions.AddIdentityMappings doesn't at the correct mappings for a "property" value of NHibernate.Dialect.MsSql2012Dialect, NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 HOT 4
- NHibernate.ISession still open when using signalr HOT 9
- Cannot derive from IdentityUser/IdentityRole HOT 1
- MySQL bindings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nhibernate.aspnetcore.identity.