Prevent pupblic property generation

Posts   
 
    
mwightman
User
Posts: 7
Joined: 31-Mar-2009
# Posted on: 27-May-2009 13:54:14   

Is it possible to stop the generation of all public getters and setters by modifying a template?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 27-May-2009 15:33:26   

Yeah, you can modify the templates as you wish.

But just for curiosity, how would you populate an entity?

mwightman
User
Posts: 7
Joined: 31-Mar-2009
# Posted on: 27-May-2009 19:10:31   

What template would I find the properties in?

Walaa wrote:

Yeah, you can modify the templates as you wish.

But just for curiosity, how would you populate an entity?

I would define the nessesary propertys and/or methods in a partial class with required scope. For the purpose of encapsaltion fields in the model should be controled via methods on the object. I also need to control the creation and removal of related entities


public class item
{

private EntityCollection<ActionEntity>Actions
{
  get {value via llblgen method;}
  set{set via llblgen method;}
}


public bool isArchived 
{
  get {value via llblgen method;}
  private set{set via llblgen method;}

}

public IArchiveInfo 
{
  get {value via llblgen method;}
  private set{set via llblgen method;}

}


public IArchiveInfo Archive()
{

if (!isArchived)
{
  IArchiveInfo ai=(IArchiveInfo )new ArchiveEntity(context.user,DateTime.Now); 
  this.ArchiveInfo=ai;
  this.Actions.add(new ActionEntity("Archive",context.user);
  return ai
}

}


public IList<string>  ActionEvents
{

   return new List<string>(Helper.Convert(this.Actions);
}

}

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-May-2009 05:35:40   

I would define the nessesary propertys and/or methods in a partial class with required scope. For the purpose of encapsaltion fields in the model should be controled via methods on the object. I also need to control the creation and removal of related entities

You already can do that (implement your own logic at entity properties) as they are virtual, you could override them and write your own code.

Also, I wouldn't recommend that practice (modify the properties visibility) as I don't know if you could experiment side effects. Read this: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=9062

David Elizondo | LLBLGen Support Team