fluent

Fluent NHibernate 3 and Oracle.DataAccess

给你一囗甜甜゛ 提交于 2019-12-08 01:31:46
问题 my question: I am trying to use Oracle.DataAccess.Client Provider with NHibernate (Fluent), and I configured it as follows: Fluently.Configure().Database(OracleClientConfiguration.Oracle10.Provider("Oracle.DataAccess.Client").ConnectionString(c => c.FromConnectionStringWithKey("ORACLE1"))). and I have this error: "Could not load type Oracle.DataAccess.Client. Possible cause: no assembly name specified.":" I already add Reference to Oracle.Dataaccess dll (ODAC) with copy local = true, but

Multiplicity constraint violations with optional-required EF Code First + Fluent relationship?

折月煮酒 提交于 2019-12-06 16:05:59
For some reason I had my made my mind a while back on an EF 6 project that I would try to avoid naming foreign keys. I defined much of the model without testing it incrementally and so I have been running into multiplicity and incomplete Fluent API definition issues: A relationship from the 'User_InternalAuth' AssociationSet is in the 'Deleted' state. Given multiplicity constraints, a corresponding 'User_InternalAuth_Target' must also in the 'Deleted' state. In one case, here is the code: nModelBuilder.Entity<User>() .HasOptional<InternalAuth>(u => u.InternalAuth) .WithRequired(a => a.User)

Fluent NHibernate Inheritance mapping type

故事扮演 提交于 2019-12-06 14:38:12
I'm new to Fluent NHibernate, thus far I managed to get my mapping working except for the inheritance part. Is there anybody who could help me finish the mapping? I have simplified the code as much as possible. Thank you! My database: CREATE TABLE [User] ( UserID INT NOT NULL IDENTITY(1,1), Type CHAR(1) NOT NULL, Email VARCHAR(255) NOT NULL, PRIMARY KEY(UserID) ); CREATE TABLE [Student] ( UserID INT NOT NULL, Firstname VARCHAR(255) NOT NULL, PRIMARY KEY(UserID), FOREIGN KEY(UserID) REFERENCES [User](UserID) ); CREATE TABLE [Company] ( UserID INT NOT NULL, Name VARCHAR(255) NOT NULL, PRIMARY

Entity Framework Fluent Mapping Optional One-To-One

▼魔方 西西 提交于 2019-12-06 14:12:35
问题 I need to set up a relationship that is currently a one-to-many: public class Foo { public int FooId { get; set; } public int? BarId { get; set; } ... public virtual Bar Bar { get; set; } } public class Bar { public int BarId { get; set; } ... public virtual ICollection<Foo> Foos { get; set; } } public FooMap() { HasKey(e => e.FooId); Property(e => e.FooId.IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity); Property(e => e.BarId).IsOptional(); ... HasOptional(e => e.Bar

Fluent Nhibernate Composite Key Not Generating Joins For Referenced Entities

懵懂的女人 提交于 2019-12-06 11:18:15
问题 I have a mapping with a composite key as below: CompositeId() .KeyReference(x => x.CreatedBy, "member_key") .KeyReference(x => x.Box, "box_key"); This works fine for simple gets and inserts, however it is not generating joins with the tables mentioned in the reference where I try and use them as part of a query. So this: return _sessionFactory.GetCurrentSession().QueryOver<BoxMember>() .Where(x => x.Box.Id == boxId) .Where(x => x.Member.DeletedDate == null) .Fetch(x => x.Box).Eager .Fetch(x =

Fluent NHibernate mappings for localization

感情迁移 提交于 2019-12-06 10:09:37
I am trying to build a Database from NHibernate mappings and have run into a problem. I have many classes with localized string values: public class MyClass1 { public virtual int Id { get; set; } public virtual ShortString Name { get; set; } public virtual LongString Description { get; set; } } public class MyClass2 { public virtual int Id { get; set; } public virtual ShortString Name { get; set; } public virtual LongString Description { get; set; } } and Languages like public class Language { public virtual string Code { get; set } public virtual string Name { get; set } } My ShortString and

EF Fluent API tutorial [closed]

╄→尐↘猪︶ㄣ 提交于 2019-12-06 09:41:08
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I want to learn Entity framework 4.1 Fluent API. Can you please send me goos links ? 回答1: The ADO.NET team blog has a lot of information on getting started. There's a good series of articles on the CTP5 release.

Port StdClass data to Model

天大地大妈咪最大 提交于 2019-12-06 08:36:55
问题 The problem is the following: 1) I have millions of rows in a few tables in the database, so using Eloquent is not efficient, as I have also multiple relationships. The solution in this case was to write custom DB::raw() selects and joins to accomplish the tasks efficiently. This returns a StdClass as you may know. 2) I have 4-5 models that have quite lengthy methods, which I need to use, so a best possible solution would be to create instances of those models for each row of the StdClass,

How to use Fluent style syntactic sugar with c# property declaration

核能气质少年 提交于 2019-12-06 07:28:49
I never used the fluent code style before. So this is hte first time I tried to develop something in the fluent style with a C# property declaration, but I get an error. Can anyone help me? public class MailTemplate { string _MailBody = ""; public MailTemplate MailBody { get { return _MailBody; } set { _MailBody = value ; } } string _Subject = ""; public MailTemplate Subject { get { return _Subject; } set { _Subject = value; } } string _MailFrom = ""; public MailTemplate MailFrom { get { return _MailFrom; } set { _MailFrom = value; } } } Please help me how I could assign or initialize the mail

Fluent NHibernate 3 and Oracle.DataAccess

丶灬走出姿态 提交于 2019-12-06 06:58:43
my question: I am trying to use Oracle.DataAccess.Client Provider with NHibernate (Fluent), and I configured it as follows: Fluently.Configure().Database(OracleClientConfiguration.Oracle10.Provider("Oracle.DataAccess.Client").ConnectionString(c => c.FromConnectionStringWithKey("ORACLE1"))). and I have this error: "Could not load type Oracle.DataAccess.Client. Possible cause: no assembly name specified.":" I already add Reference to Oracle.Dataaccess dll (ODAC) with copy local = true, but error persist... Any suggestions? Here's a working code snippet: public static void InitializeNHibernate()