Skip to content

Simplify adding a DbItem to a Db and getting the Item instance back out of the FakeDb #98

@sshushliapin

Description

@sshushliapin

Asked by @kamsar in Twitter. The problem is that in order to get an Item instance, one have to write three lines of code:

DbItem dbItem = new DbItem("item");
db.Add(dbItem);
Item item = db.GetItem("/sitecore/content/item");

There is a suggestion to introduce new db.Create() extension method which would combine the Add() and GetItem() functionality:

DbItem dbItem = new DbItem("item");
Item item = db.Create(dbItem);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions