Created
September 3, 2011 13:02
-
-
Save akorchev/1191154 to your computer and use it in GitHub Desktop.
Active Record vs Unit of Work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Active Record | |
var User = Model.define( { | |
id: "UserID", | |
transport: { | |
create: "create.php" | |
} | |
}); | |
var user = new User(); | |
user.set($("form").serialize()); | |
user.save(); | |
// Unit of work | |
var User = Model.define( { | |
id: "UserID", | |
}); | |
var dataSource = new DataSource( { | |
model: User, | |
transport: { | |
create: "create.php" | |
} | |
}); | |
var user = new User(); | |
user.set($("form").serialize()); | |
dataSource.add(user); | |
dataSource.sync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment