本文整理汇总了C#中TypedEntity类的典型用法代码示例。如果您正苦于以下问题:C# TypedEntity类的具体用法?C# TypedEntity怎么用?C# TypedEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypedEntity类属于命名空间,在下文中一共展示了TypedEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapTypedEntity
public static TypedEntity MapTypedEntity(XElement xElement)
{
Mandate.ParameterNotNull(xElement, "xElement");
var attribs = new HashSet<TypedAttribute>();
var ordinal = 0;
foreach (var childElement in xElement.Elements().Where(x => !x.HasAttributes))
{
var typedAttribute = new TypedAttribute(new AttributeDefinition()
{
Alias = childElement.Name.LocalName,
Name = childElement.Name.LocalName,
Ordinal = ordinal,
Id = HiveId.Empty
}, childElement.Value)
{
Id = HiveId.Empty
};
attribs.Add(typedAttribute);
ordinal++;
}
var nodeId = (int)xElement.Attribute("id");
var returnValue = new TypedEntity
{
// TODO: Replace provider id with injected value inside UoWFactory
Id = new HiveId("content", "r-xmlstore-01", new HiveIdValue(nodeId))
};
returnValue.Attributes.Reset(attribs);
return returnValue;
}
示例2: CompositeTypedEntity
public CompositeTypedEntity(TypedEntity entity)
{
Attributes.Clear();
entity.Attributes.ForEach(x => Attributes.Add(x));
RelationProxies.LazyLoadDelegate = entity.RelationProxies.LazyLoadDelegate;
}
示例3: GetIdPath_Returns_In_Correct_Order_For_Entities
public void GetIdPath_Returns_In_Correct_Order_For_Entities()
{
//mock hive
IReadonlyEntityRepositoryGroup<IContentStore> readonlyEntitySession;
IReadonlySchemaRepositoryGroup<IContentStore> readonlySchemaSession;
IEntityRepositoryGroup<IContentStore> entityRepository;
ISchemaRepositoryGroup<IContentStore> schemaSession;
var hive = MockHiveManager.GetManager().MockContentStore(out readonlyEntitySession, out readonlySchemaSession, out entityRepository, out schemaSession);
var entity = new TypedEntity {Id = new HiveId(100)};
entityRepository.Get<TypedEntity>(Arg.Any<bool>(), Arg.Any<HiveId[]>()).Returns(new[] {entity});
entityRepository.GetAncestorRelations(new HiveId(100), FixedRelationTypes.DefaultRelationType)
.Returns(new[]
{
new Relation(FixedRelationTypes.DefaultRelationType, new TypedEntity{Id = new HiveId(99)}, entity),
new Relation(FixedRelationTypes.DefaultRelationType, new TypedEntity{Id = new HiveId(98)}, new TypedEntity{Id = new HiveId(99)}),
new Relation(FixedRelationTypes.DefaultRelationType, new TypedEntity{Id = new HiveId(97)}, new TypedEntity{Id = new HiveId(98)}),
});
using (var uow = hive.OpenWriter<IContentStore>())
{
var path = uow.Repositories.GetEntityPath<TypedEntity>(new HiveId(100), FixedRelationTypes.DefaultRelationType);
Assert.AreEqual(new HiveId(97), path.ElementAt(0));
Assert.AreEqual(new HiveId(98), path.ElementAt(1));
Assert.AreEqual(new HiveId(99), path.ElementAt(2));
Assert.AreEqual(new HiveId(100), path.ElementAt(3));
}
}
示例4: CreateTooltipContentsViaTask
/// <summary>
/// Returns the TooltipContents after proxying through the task system to allow developers to modify the output
/// </summary>
/// <param name="ds"></param>
/// <param name="sender"></param>
/// <param name="entity"> </param>
/// <param name="htmlContent"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
public static TooltipContents CreateTooltipContentsViaTask(this INodeSelectorDataSource ds,
object sender,
TypedEntity entity,
string htmlContent,
int width = -1,
int height = -1)
{
var args = new NodeSelectorTooltipEventArgs(entity, htmlContent)
{
Height = height,
Width = width
};
//launch task to modify the contents
ds.FrameworkContext.TaskManager
.ExecuteInContext(
NodeSelectorTaskTriggers.GetTooltipContents,
sender,
new TaskEventArgs(ds.FrameworkContext, args));
return new TooltipContents(args.HtmlContents)
{
Height = args.Height,
Width = args.Width
};
}
示例5: EntityVillager
public EntityVillager(TypedEntity e)
: base(e)
{
EntityVillager e2 = e as EntityVillager;
if (e2 != null) {
_profession = e2._profession;
}
}
示例6: EntityPrimedTnt
public EntityPrimedTnt(TypedEntity e)
: base(e)
{
EntityPrimedTnt e2 = e as EntityPrimedTnt;
if (e2 != null) {
_fuse = e2._fuse;
}
}
示例7: EntityFallingSand
public EntityFallingSand(TypedEntity e)
: base(e)
{
EntityFallingSand e2 = e as EntityFallingSand;
if (e2 != null) {
_tile = e2._tile;
}
}
示例8: EntityCreeper
public EntityCreeper(TypedEntity e)
: base(e)
{
EntityCreeper e2 = e as EntityCreeper;
if (e2 != null) {
_powered = e2._powered;
}
}
示例9: EntityMinecart
public EntityMinecart (TypedEntity e)
: base(e)
{
EntityMinecart e2 = e as EntityMinecart;
if (e2 != null) {
_type = e2._type;
}
}
示例10: EntityPigZombie
public EntityPigZombie(TypedEntity e)
: base(e)
{
EntityPigZombie e2 = e as EntityPigZombie;
if (e2 != null) {
_anger = e2._anger;
}
}
示例11: EntityGuardian
public EntityGuardian (TypedEntity e)
: base(e)
{
EntityGuardian e2 = e as EntityGuardian;
if (e2 != null) {
_elder = e2._elder;
}
}
示例12: EntityMinecartChest
public EntityMinecartChest (TypedEntity e)
: base(e)
{
EntityMinecartChest e2 = e as EntityMinecartChest;
if (e2 != null) {
_items = e2._items.Copy();
}
}
示例13: EntitySlime
public EntitySlime(TypedEntity e)
: base(e)
{
EntitySlime e2 = e as EntitySlime;
if (e2 != null) {
_size = e2._size;
}
}
示例14: EntityPig
public EntityPig(TypedEntity e)
: base(e)
{
EntityPig e2 = e as EntityPig;
if (e2 != null) {
_saddle = e2._saddle;
}
}
示例15: EntitySheep
public EntitySheep (TypedEntity e)
: base(e)
{
EntitySheep e2 = e as EntitySheep;
if (e2 != null) {
_sheared = e2._sheared;
_color = e2._color;
}
}