本文整理汇总了C#中EntityType类的典型用法代码示例。如果您正苦于以下问题:C# EntityType类的具体用法?C# EntityType怎么用?C# EntityType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityType类属于命名空间,在下文中一共展示了EntityType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RemoveEntityType
private EntityType RemoveEntityType(EntityType entityType)
{
var referencingForeignKey = entityType.GetDeclaredReferencingForeignKeys().FirstOrDefault();
if (referencingForeignKey != null)
{
throw new InvalidOperationException(
CoreStrings.EntityTypeInUseByForeignKey(
entityType.DisplayName(),
"{" + string.Join(", ", referencingForeignKey.Properties.Select(p => "'" + p.Name + "'")) + "}",
referencingForeignKey.DeclaringEntityType.DisplayName()));
}
var derivedEntityType = entityType.GetDirectlyDerivedTypes().FirstOrDefault();
if (derivedEntityType != null)
{
throw new InvalidOperationException(
CoreStrings.EntityTypeInUseByDerived(
entityType.DisplayName(),
derivedEntityType.DisplayName()));
}
var removed = _entityTypes.Remove(entityType.Name);
entityType.Builder = null;
return entityType;
}
开发者ID:nefremov,项目名称:LazyEntityFramework,代码行数:26,代码来源:MaterializingModel.cs
示例2: EntityType
public static EntityType EntityType()
{
var entityType = new EntityType(typeof(IntKeysPoco));
entityType.AddProperty("PartitionID", typeof(int)).SetColumnName("PartitionKey");
entityType.AddProperty("RowID", typeof(int)).SetColumnName("RowKey");
return entityType;
}
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:7,代码来源:SimpleTestTypes.cs
示例3: Resolve
public override bool Resolve(ICollection<IEntity> resultingSet, string name, EntityType typesToConsider)
{
bool found = false;
foreach (InternalModule m in InternalModules())
{
if (string.IsNullOrEmpty(m.Namespace))
{
if (m.Resolve(resultingSet, name, typesToConsider))
found = true;
continue;
}
if (!HasNamespacePrefix(m, name))
continue;
if (m.Namespace.Length == name.Length)
{
resultingSet.Add(m.ModuleMembersNamespace);
found = true;
continue;
}
if (m.Namespace[name.Length] == '.')
{
resultingSet.Add(new PartialModuleNamespace(name, m));
found = true;
continue;
}
}
return found;
}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:31,代码来源:CompileUnitNamespace.cs
示例4: InstantiateEntityType
private GameObject InstantiateEntityType(EntityType entityType, Vector3 position, Quaternion rotation)
{
GameObject instantiateObject = null;
switch (entityType)
{
case EntityType.Worker:
instantiateObject = (GameObject)Instantiate(WorkerPrefab, position, rotation);
break;
case EntityType.WarriorGreen:
instantiateObject = (GameObject)Instantiate(WarriorGreenPrefab, position, rotation);
break;
case EntityType.Tower:
towerSelector.StartCreating();
instantiateObject = null;
break;
case EntityType.WarriorYellow:
instantiateObject = (GameObject)Instantiate(WarriorYellowPrefab, position, rotation);
break;
case EntityType.WarriorRed:
instantiateObject = (GameObject)Instantiate(WarriorRedPrefab, position, rotation);
break;
default:
break;
}
return instantiateObject;
}
开发者ID:noxytrux,项目名称:War-of-the-Farm-Legend,代码行数:31,代码来源:EntityCreator.cs
示例5: GetEntitiesTags
public Dictionary<int, List<String>> GetEntitiesTags(EntityType entityType)
{
var result = new Dictionary<int, List<String>>();
var sqlQuery =
new SqlQuery("crm_entity_tag")
.Select("entity_id", "title")
.LeftOuterJoin("crm_tag", Exp.EqColumns("id", "tag_id"))
.Where(Exp.Eq("crm_tag.entity_type", (int)entityType) & Exp.Eq("crm_tag.tenant_id", TenantID))
.OrderBy("entity_id", true)
.OrderBy("title", true);
using (var db = GetDb())
{
db.ExecuteList(sqlQuery).ForEach(row =>
{
var entityID = Convert.ToInt32(row[0]);
var tagTitle = Convert.ToString(row[1]);
if (!result.ContainsKey(entityID))
result.Add(entityID, new List<String>
{
tagTitle
});
else
result[entityID].Add(tagTitle);
});
}
return result;
}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:32,代码来源:TagDao.cs
示例6: Thesis
public Thesis(string inputTitle, string inputAuthor, int inputYear,
ThesisType inputThesisEntityType, string inputSchool, EntityType inputEntityType, DateTime inputEntryDate)
: base(inputTitle, inputAuthor, inputYear, inputEntityType, inputEntryDate)
{
School = inputSchool;
ThesisEntityType = inputThesisEntityType;
}
开发者ID:edgars-supe,项目名称:dotnet-hw1,代码行数:7,代码来源:Thesis.cs
示例7: mdEdit_SaveClick
/// <summary>
/// Handles the SaveClick event of the mdEdit control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void mdEdit_SaveClick( object sender, EventArgs e )
{
var rockContext = new RockContext();
EntityTypeService entityTypeService = new EntityTypeService( rockContext );
EntityType entityType = entityTypeService.Get( int.Parse( hfEntityTypeId.Value ) );
if ( entityType == null )
{
entityType = new EntityType();
entityType.IsEntity = true;
entityType.IsSecured = true;
entityTypeService.Add( entityType );
}
entityType.Name = tbName.Text;
entityType.FriendlyName = tbFriendlyName.Text;
entityType.IsCommon = cbCommon.Checked;
rockContext.SaveChanges();
EntityTypeCache.Flush( entityType.Id );
hfEntityTypeId.Value = string.Empty;
HideDialog();
BindGrid();
}
开发者ID:RMRDevelopment,项目名称:Rockit,代码行数:33,代码来源:EntityTypes.ascx.cs
示例8: CreateModelElementForEFObjectType
private static ModelElement CreateModelElementForEFObjectType(EFObject obj, Partition partition)
{
ModelElement modelElement = null;
var t = obj.GetType();
if (t == typeof(ConceptualEntityModel))
{
modelElement = new EntityDesignerViewModel(partition);
}
else if (t == typeof(ConceptualEntityType))
{
modelElement = new EntityType(partition);
}
else if (t == typeof(ConceptualProperty))
{
modelElement = new ScalarProperty(partition);
}
else if (t == typeof(ComplexConceptualProperty))
{
modelElement = new ComplexProperty(partition);
}
else if (t == typeof(Association))
{
modelElement = new ViewModel.Association(partition);
}
else if (t == typeof(EntityTypeBaseType))
{
modelElement = new Inheritance(partition);
}
else if (t == typeof(NavigationProperty))
{
modelElement = new ViewModel.NavigationProperty(partition);
}
return modelElement;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:35,代码来源:ModelToDesignerModelXRef.cs
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
_manageTagPopup.Options.IsPopup = true;
entityType = StringToEntityType(Request["view"]);
_switcherEntityType.SortItemsHeader = CRMCommonResource.Show + ":";
_forContacts.SortLabel = CRMSettingResource.BothPersonAndCompany;
_forContacts.SortUrl = "settings.aspx?type=tag";
_forContacts.IsSelected = entityType == EntityType.Contact;
_forDeals.SortLabel = CRMCommonResource.DealModuleName;
_forDeals.SortUrl = String.Format("settings.aspx?type=tag&view={0}", EntityType.Opportunity.ToString().ToLower());
_forDeals.IsSelected = entityType == EntityType.Opportunity;
_forCases.SortLabel = CRMCommonResource.CasesModuleName;
_forCases.SortUrl = String.Format("settings.aspx?type=tag&view={0}", EntityType.Case.ToString().ToLower());
_forCases.IsSelected = entityType == EntityType.Case;
RegisterClientScriptHelper.DataTagSettingsView(Page, entityType);
RegisterScript();
}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:25,代码来源:TagSettingsView.ascx.cs
示例10: Get_generation_property_returns_generation_property_from_foreign_key_tree
public void Get_generation_property_returns_generation_property_from_foreign_key_tree()
{
var model = new Model();
var leftType = new EntityType("Left", model);
var leftId = leftType.AddProperty("Id", typeof(int), true);
var leftKey = leftType.AddKey(leftId);
var rightType = new EntityType("Right", model);
var rightId1 = rightType.AddProperty("Id1", typeof(int), true);
var rightId2 = rightType.AddProperty("Id2", typeof(int), true);
var rightKey = rightType.AddKey(new[] { rightId1, rightId2 });
var middleType = new EntityType("Middle", model);
var middleProperty1 = middleType.AddProperty("FK1", typeof(int), true);
var middleProperty2 = middleType.AddProperty("FK2", typeof(int), true);
var middleKey1 = middleType.AddKey(middleProperty1);
var middleFK1 = middleType.AddForeignKey(middleProperty1, leftKey, leftType);
var middleFK2 = middleType.AddForeignKey(new[] { middleProperty2, middleProperty1 }, rightKey, rightType);
var endType = new EntityType("End", model);
var endProperty = endType.AddProperty("FK", typeof(int), true);
var endFK = endType.AddForeignKey(endProperty, middleKey1, middleType);
rightId2.RequiresValueGenerator = true;
Assert.Equal(rightId2, endProperty.GetGenerationProperty());
}
开发者ID:JamesWang007,项目名称:EntityFramework,代码行数:29,代码来源:PropertyExtensionsTest.cs
示例11: buildNoticeLink
private string buildNoticeLink(NotificationType noticeType, int entityId, EntityType entityType)
{
string result = "";
switch (entityType)
{
case EntityType.Project:
switch (noticeType)
{
case NotificationType.BidSubmitted:
result = string.Format("/Project/{0}/Bid/Received", entityId);
break;
case NotificationType.InvitationRequest:
result = string.Format("/Project/{0}/Invitation/Requests", entityId);
break;
case NotificationType.InvitationResponse:
case NotificationType.InvitationToBid:
case NotificationType.ProjectChange:
result = string.Format("/Project/Details/{0}", entityId);
break;
}
break;
case EntityType.Company:
switch (noticeType)
{
case NotificationType.ConnectionAccepted:
case NotificationType.RequestToConnect:
result = string.Format("/Company/Profile/{0}", entityId);
break;
}
break;
}
return result;
}
开发者ID:JoshIBrown,项目名称:BidChuck,代码行数:35,代码来源:NotificationsController.cs
示例12: AddNewRowOfType
/// <summary>
/// Adds a new row to the EntitySet with the specified entity type.
/// </summary>
/// <param name="entityType">Entity type for the new row.</param>
/// <returns>Instance of <see cref="EntitySetDataRow"/> for the newly added row.</returns>
public EntitySetDataRow AddNewRowOfType(EntityType entityType)
{
ExceptionUtilities.CheckArgumentNotNull(entityType, "entityType");
this.CheckEntityTypeBelongsToEntitySet(entityType);
return this.AddNewRowOfTypeInternal(entityType);
}
开发者ID:larsenjo,项目名称:odata.net,代码行数:12,代码来源:EntitySetData.cs
示例13: AnimatedSprite
public AnimatedSprite(Texture2D texture, EntityType entityType, IList<AnimationSequence> animations, AnimationActions initialAnimationAction,
Rectangle worldPosition, Vector2 speed = new Vector2(), Vector2 direction = new Vector2(), bool isCollidable = false, int collisionOffset = 0)
: base(texture, entityType, worldPosition, speed: speed, direction: direction, isCollidable: isCollidable, collisionOffset: collisionOffset)
{
Animations = animations;
CurrentAnimation = Animations.First(a => a.AnimationAction == initialAnimationAction);
}
开发者ID:MrTwitch,项目名称:XnaOgres2DGame,代码行数:7,代码来源:AnimatedSprite.cs
示例14: SearchByTags
protected List<int> SearchByTags(EntityType entityType, int[] exceptIDs, IEnumerable<String> tags)
{
if (tags == null || !tags.Any())
throw new ArgumentException();
var tagIDs = new List<int>();
foreach (var tag in tags)
tagIDs.Add(DbManager.ExecuteScalar<int>(Query("crm_tag")
.Select("id")
.Where(Exp.Eq("entity_type", (int)entityType ) & Exp.Eq("title", tag))));
var sqlQuery = new SqlQuery("crm_entity_tag")
.Select("entity_id")
.Select("count(*) as count")
.GroupBy("entity_id")
.Having(Exp.Eq("count", tags.Count()));
if (exceptIDs != null && exceptIDs.Length > 0)
sqlQuery.Where(Exp.In("entity_id", exceptIDs) & Exp.Eq("entity_type", (int)entityType));
else
sqlQuery.Where(Exp.Eq("entity_type", (int)entityType));
sqlQuery.Where(Exp.In("tag_id", tagIDs));
return DbManager.ExecuteList(sqlQuery).ConvertAll(row => Convert.ToInt32(row[0]));
}
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:28,代码来源:AbstractDao.cs
示例15: AAnimate
public AAnimate(SpriteSheet sp, EntityType type, string texture_path, float posx, float posy, float speed)
: base(type, texture_path, posx, posy, speed)
{
sprite = sp;
Width = sp.getWidth();
Height = sp.getHeight();
}
开发者ID:jorge-d,项目名称:Angry-Grandmas,代码行数:7,代码来源:AAnimate.cs
示例16: UnitDefinition
/// <summary>
/// Initializes a new instance of the <see cref="Core.Models.Definitions.UnitDefinition"/> class.
/// </summary>
/// <param name="unitType">Unit type.</param>
/// <param name="actions">Actions which are possible.</param>
/// <param name="attack">Attack damage.</param>
/// <param name="defense">Defense of the entity.</param>
/// <param name="health">Health of the entity.</param>
/// <param name="moves">Move range.</param>
/// <param name="attackRange">Attack range.</param>
/// <param name="population">Population cost.</param>
/// <param name="scrapcost">Scrap cost.</param>
/// <param name="energycost">Energy cost.</param>
/// <param name="plutoniumcost">Plutonium cost.</param>
/// <param name="techcost">Tech cost.</param>
public UnitDefinition(
EntityType unitType,
string[] actions,
int attack,
int defense,
int health,
int moves,
int attackRange,
int population,
int scrapcost,
int energycost,
int plutoniumcost,
int techcost)
: base((int)unitType)
{
Actions = actions;
Attack = attack;
Defense = defense;
Health = health;
Moves = moves;
AttackRange = attackRange;
Population = population;
Scrapecost = scrapcost;
Energycost = energycost;
Plutoniumcost = plutoniumcost;
Techcost = techcost;
}
开发者ID:Lopt,项目名称:ascendancy,代码行数:42,代码来源:UnitDefinition.cs
示例17: Article
public Article(string inputTitle, string inputAuthors, int inputYear,
string inputJournal, int inputVolume, EntityType inputEntityType, DateTime inputEntryDate)
: base(inputTitle, inputAuthors, inputYear, inputEntityType, inputEntryDate)
{
Journal = inputJournal;
Volume = inputVolume;
}
开发者ID:edgars-supe,项目名称:dotnet-hw1,代码行数:7,代码来源:Article.cs
示例18: DefaultThumbnailViewModel
/// <summary>
/// Initializes a new instance of the DefaultThumbnailViewModel class.
/// </summary>
/// <param name="thumbnailID">Thumbnail Guid</param>
/// <param name="entity">Type of the entity</param>
/// <param name="altText">Alt text for IMG tag</param>
/// <param name="contentType">Content Type of the content. In case of community, it will be generic which will not be used.</param>
public DefaultThumbnailViewModel(Guid? thumbnailID, EntityType entity, string altText, ContentTypes contentType)
{
this.ThumbnailID = thumbnailID;
this.Entity = entity;
this.AltText = HttpContext.Current.Server.HtmlEncode(altText);
this.ContentType = contentType;
}
开发者ID:faorg,项目名称:wwt-website,代码行数:14,代码来源:DefaultThumbnailViewModel.cs
示例19: CreateEntityFieldsObject
/// <summary>General factory entrance method which will return an EntityFields object with the format generated by the factory specified</summary>
/// <param name="relatedEntityType">The type of entity the fields are for</param>
/// <returns>The IEntityFields2 instance requested</returns>
public static IEntityFields2 CreateEntityFieldsObject(EntityType relatedEntityType)
{
IEntityFields2 fieldsToReturn=null;
switch(relatedEntityType)
{
case DirectSports.BL.EntityType.ProductEntity:
fieldsToReturn = CreateProductEntityFields();
break;
case DirectSports.BL.EntityType.ProductSectionEntity:
fieldsToReturn = CreateProductSectionEntityFields();
break;
case DirectSports.BL.EntityType.RoleEntity:
fieldsToReturn = CreateRoleEntityFields();
break;
case DirectSports.BL.EntityType.SpecialOfferEntity:
fieldsToReturn = CreateSpecialOfferEntityFields();
break;
case DirectSports.BL.EntityType.UserEntity:
fieldsToReturn = CreateUserEntityFields();
break;
case DirectSports.BL.EntityType.UserRoleLinkEntity:
fieldsToReturn = CreateUserRoleLinkEntityFields();
break;
}
return fieldsToReturn;
}
开发者ID:rrmarriott,项目名称:DirectSports,代码行数:29,代码来源:EntityFieldsFactory.cs
示例20: Create
/// <summary>Creates a new, empty Entity object of the type specified</summary>
/// <param name="entityTypeToCreate">The entity type to create.</param>
/// <returns>A new, empty Entity object.</returns>
public static IEntity2 Create(EntityType entityTypeToCreate)
{
IEntityFactory2 factoryToUse = null;
switch(entityTypeToCreate)
{
case DirectSports.BL.EntityType.ProductEntity:
factoryToUse = new ProductEntityFactory();
break;
case DirectSports.BL.EntityType.ProductSectionEntity:
factoryToUse = new ProductSectionEntityFactory();
break;
case DirectSports.BL.EntityType.ProductVariationEntity:
factoryToUse = new ProductVariationEntityFactory();
break;
case DirectSports.BL.EntityType.RoleEntity:
factoryToUse = new RoleEntityFactory();
break;
case DirectSports.BL.EntityType.SpecialOfferEntity:
factoryToUse = new SpecialOfferEntityFactory();
break;
case DirectSports.BL.EntityType.UserEntity:
factoryToUse = new UserEntityFactory();
break;
case DirectSports.BL.EntityType.UserRoleLinkEntity:
factoryToUse = new UserRoleLinkEntityFactory();
break;
}
return factoryToUse.Create();
}
开发者ID:rrmarriott,项目名称:DirectSports,代码行数:32,代码来源:EntityFactories.cs
注:本文中的EntityType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论