Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace TestProject.Model
- {
- public class Room
- {
- public virtual int Id { get; set; }
- public virtual string UniqueID { get; set; }
- public virtual int RoomID { get; set; }
- public virtual float Area { get; set; }
- }
- }
- public RoomProperty()
- {
- }
- public RoomProperty(int pRoomId, int pArea)
- {
- UniqueID = Guid.NewGuid().ToString();
- RoomID = pRoomId;
- Area = pArea;
- }
- "ConstructorShouldNotCallVirtualMethodsRule"
- This rule warns the developer if any virtual methods are called in the constructor of a non-sealed type. The problem is that if a derived class overrides the method then that method will be called before the derived constructor has had a chance to run. This makes the code quite fragile.
- public void SetRoomPropertyData(int pRoomId, int pArea)
- {
- UniqueID = Guid.NewGuid().ToString();
- RoomID = pRoomId;
- Area = pArea;
- }
- NHibernate.InvalidProxyTypeException: The following types may not be used as proxies:
- VITRIcadHelper.Model.RoomProperty: method SetRoomPropertyData should be 'public/protected virtual' or 'protected internal virtual'
- public class Room
- {
- public virtual int Id { get; set; }
- public virtual string UniqueID { get; set; }
- public virtual int RoomID { get; set; }
- public virtual float Area { get; set; }
- public static Room Create(int roomId, int area)
- {
- Room room = new Room();
- room.UniqueID = Guid.NewGuid().ToString();
- room.RoomID = roomId;
- room.Area = area;
- return room;
- }
- }
Add Comment
Please, Sign In to add comment