Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- ActiveRecordStarter.ResetInitializationFlag();
- IConfigurationSource source = new XmlConfigurationSource("appconfig.xml");
- ActiveRecordStarter.Initialize(Assembly.GetAssembly(typeof(CastleActiveRecordSample.Person)), source);
- ActiveRecordStarter.DropSchema();
- ActiveRecordStarter.CreateSchema();
- Person user1 = new Person();
- user1.UserName = "kwon";
- user1.Password = "hj";
- user1.Create();
- Person user2 = new Person();
- user2.UserName = "Lee";
- user2.Password = "sj";
- user2.Create();
- var users = Person.FindAll();
- foreach (var item in users)
- {
- Console.WriteLine("id:{0}, name:{1}, password:{2}", item.Id, item.UserName, item.Password);
- }
- Console.Read();
- }
- }
- [ActiveRecord]
- public class Person : ActiveRecordBase<Person>
- {
- [PrimaryKey]
- public int Id { get; set; }
- [Property]
- public string UserName { get; set; }
- [Property]
- public string Password { get; set; }
- }
Add Comment
Please, Sign In to add comment