How to configure POCO using Subsonic 3 and SimpleRepostitory? or where is the convention?

Are there any details that describe how to set up POCO when using SimpleRepository with SubSonic 3? This seems to be a configuration convention, but I cannot find where this convention is explained.

http://www.subsonicproject.com/docs/Conventions looks as if it is intended for 2.0, and is also marked as incomplete. (By the way: I would like to help reorganize documents into more than 2.0 and 3.0, as current documents are a bit confusing which version they are referencing.)

For example, I would like to know how I would decide to create

one-to-one relationship

User <=> Profile

class User {
  Id
  ProfileId instead of Profile? or is Profile profile possible?
}

class Profile {
  Id
  UserId instead of User? or is User user possible?
}

One-to-many relationship

class User {
  Id
  IList<Post> Posts (?) or IList<int> PostIds (?) or is this implied somehow?  or is this just wrong?
}

class Post {
  Id
  UserId instead of User? or is User user possible?
}

Many-to-many

I assume I need to set up many tables?

class User {
  IList<Blog> Blogs (?) or IList<int> BlogIds (?) or is this implied somehow?
}

class BlogsUsers {  // Do I have to create this class?
  UserId
  BlogId
}

class User {
  IList<User> Users (?) or IList<int> UserIds (?) or is this implied somehow?
}

, , , ( ):

--

User.Profile

r.Single<Profile>(p=>p.User == userId);

parent on one-to-many

Post.User

id = r.Single<Post>(postId).UserId;
r.Single<User>(id); // which kind of stinks with two queries, JOIN?

--

User.Posts

r.Find<Post>(p=>p.UserId == userId)

--

User.Blogs

ids = r.Find<BlogsUsers>(bu=>bu.UserId == userId);
r.Find<Blog>(b=>b.BlogId == ids);  // again with the two queries?  :)

Blog.Users

ids = r.Find<BlogsUsers>(bu=>bu.BlogId == blogId);
r.Find<User>(u=>u.UserId == ids);  // again with the two queries?  :)

, - . , , , , . !: P

autogen'd, 3.0? , , SO'er.

0
1

, , : http://subsonicproject.com/docs/Using_SimpleRepository

, , (, , ). , , , "" . - .

, , - .

+1

Source: https://habr.com/ru/post/1720568/


All Articles