private static void GetExpandContent(MemberBase mb, StringBuilder expandStr, string parentName) { NavigateMember nm = mb as NavigateMember; if (nm != null) { if (nm.IsExpand) { string expandName = nm.Name; if (!string.IsNullOrEmpty(parentName)) { expandName = parentName + "($expand=" + nm.Name + ")"; } expandStr.AppendFormat("\"{0}\",", expandName); } if (nm.Children.Count() > 0) { foreach (var child in nm.Children) { if (child.MemberType == EMemberType.NavigateMember) { GetExpandContent(child, expandStr, nm.Name); } } } } }
//----------------------------------------------------------------------------------------------------------------------------------------------------- private void VisitMemberAs <TMember>(MemberBase member, Will willFlag, Action <TMember> visitAction) where TMember : MemberBase { if (m_Will.HasFlag(willFlag)) { visitAction((TMember)member); } }
private static string GetParameterContent(MemberBase mb) { StringBuilder result = new StringBuilder(); switch (mb.MemberType) { case EMemberType.ScreenParameters: var screenParameters = mb as ScreenParameters; foreach (var child in screenParameters.Children) { string paras = GetParameterString(child); result.Append(paras); } break; case EMemberType.QueryParameters: var queryParameters = mb as QueryParameters; foreach (var child in queryParameters.Children) { string paras = GetParameterString(child); result.Append(paras); } break; case EMemberType.ReportParameters: var reportParameters = mb as ReportParameters; foreach (var child in reportParameters.Children) { string paras = GetParameterString(child); result.Append(paras); } break; } return(result.ToString()); }
public PropertyPrimaryData(MemberBase member, EntityMetadata entity, bool isInherit) : base(member, entity, isInherit) { Key(); switch (Member.GenerateMode) { case EPrimaryGenerateMode.Identity: DatabaseGenerated("Identity"); break; case EPrimaryGenerateMode.Database: DatabaseGenerated("Identity"); GeneratedProperty(Member.DatabaseGenerate, ""); break; case EPrimaryGenerateMode.Disabled: DatabaseGenerated("None"); break; } DecimalType dec = member.Content as DecimalType; if (dec != null) { Precision(dec.Precision, dec.Scale); } }
private IEnumerable <Instruction> ParseCollectionInsideThisProperty(MemberBase member) { yield return(Inject.StartOfMember(member)); if (IsBeginingOfImplicitCollection) { yield return(Inject.GetObject()); yield return(Inject.Items()); foreach (var instruction in ParseElements()) { yield return(instruction); } yield return(Inject.EndOfMember()); yield return(Inject.EndOfObject()); } else { foreach (var xamlInstruction in ParseNonEmptyElement()) { yield return(xamlInstruction); } } yield return(Inject.EndOfMember()); }
private static DirectiveKind GetDirectiveKind(MemberBase member) { if (member.Equals(CoreTypes.Initialization)) { return(DirectiveKind.Initialization); } if (member.Equals(CoreTypes.Items)) { return(DirectiveKind.Items); } if (member.Equals(CoreTypes.Key)) { return(DirectiveKind.Key); } if (member.Equals(CoreTypes.MarkupExtensionArguments)) { return(DirectiveKind.MarkupExtensionArguments); } if (member.Equals(CoreTypes.Name)) { return(DirectiveKind.Name); } if (member.Equals(CoreTypes.UnknownContent)) { return(DirectiveKind.UnknownContent); } throw new InvalidOperationException($"Unexpected XAML directive. The directive {member} has been found and we don't know how to handle it."); }
public PropertyColumnData(MemberBase member, EntityMetadata entity, bool isInherit) : base(member, entity, isInherit) { switch (Member.GenerateMode) { case EColumnGenerateMode.Database: DatabaseGenerated("Computed"); GeneratedProperty(Member.DatabaseGenerate); break; case EColumnGenerateMode.DatabaseCreate: DatabaseGenerated("Computed"); GeneratedProperty(Member.DatabaseGenerate, ""); break; case EColumnGenerateMode.DatabaseUpdate: DatabaseGenerated("Computed"); GeneratedProperty("", Member.DatabaseGenerate); break; } DecimalType dec = member.Content as DecimalType; if (dec != null) { Precision(dec.Precision, dec.Scale); } }
private static DirectiveKind GetDirectiveKind(MemberBase member) { if (member.Equals(CoreTypes.Initialization)) { return DirectiveKind.Initialization; } if (member.Equals(CoreTypes.Items)) { return DirectiveKind.Items; } if (member.Equals(CoreTypes.Key)) { return DirectiveKind.Key; } if (member.Equals(CoreTypes.MarkupExtensionArguments)) { return DirectiveKind.MarkupExtensionArguments; } if (member.Equals(CoreTypes.Name)) { return DirectiveKind.Name; } if (member.Equals(CoreTypes.UnknownContent)) { return DirectiveKind.UnknownContent; } throw new InvalidOperationException($"Unexpected XAML directive. The directive {member} has been found and we don't know how to handle it."); }
//----------------------------------------------------------------------------------------------------------------------------------------------------- private void VisitMember(MemberBase member) { switch (member.Kind) { case MemberKind.StaticField: case MemberKind.InstanceField: VisitMemberAs <FieldMember>(member, Will.DecorateFields, VisitField); break; case MemberKind.StaticConstructor: case MemberKind.InstanceConstructor: VisitMemberAs <ConstructorMember>(member, Will.DecorateConstructors, VisitConstructor); break; case MemberKind.StaticAnonymousMethod: case MemberKind.InstanceAnonymousMethod: case MemberKind.VirtualMethod: VisitMemberAs <MethodMember>(member, Will.DecorateMethods, VisitMethod); break; case MemberKind.InstanceProperty: VisitMemberAs <PropertyMember>(member, Will.DecorateProperties, VisitProperty); break; case MemberKind.InstanceEvent: VisitMemberAs <EventMember>(member, Will.DecorateEvents, VisitEvent); break; } }
public static XamlMember ToWpf(this MemberBase member, XamlSchemaContext context) { if (member.IsDirective) { return(GetDirective(member, context)); } return(GetMember((MutableMember)member, context)); }
public void Equals_OtherRepresentsSimilarMemberInOtherType_ReturnsFalse() { var member = CreateMember <Target>(x => x.Property); MemberBase other = CreateMember <Target2>(x => x.Property); var result = member.Equals(other); Assert.That(result, Is.False); }
public void Equals_OtherRepresentsSameMember_ReturnsTrue() { var member = CreateMember <Target>(x => x.Property); MemberBase other = CreateMember <Target>(x => x.Property); var result = member.Equals(other); Assert.That(result, Is.True); }
public void Equals_OtherIsNull_ReturnsFalse() { var member = CreateMember <Target>(x => x.Property); MemberBase other = null; var result = member.Equals(other); Assert.That(result, Is.False); }
private static string TranslateDirectiveName(MemberBase member) { if (member.Name == "_MarkupExtensionParameters") { return "_PositionalParameters"; } return member.Name; }
private static string TranslateDirectiveName(MemberBase member) { if (member.Name == "_MarkupExtensionParameters") { return("_PositionalParameters"); } return(member.Name); }
public void Equals_OtherRepresentsDifferentMemberInSameType_ReturnsFalse() { var member = CreateMember <Target>(x => x.Property); MemberBase other = CreateMember <Target>(x => x.OtherProperty); var result = member.Equals(other); Assert.That(result, Is.False); }
public DynamicSiteClass(TypeContainer parent, MemberBase host, TypeParameter[] tparams) : base(parent, MakeMemberName(host, "DynamicSite", parent.DynamicSitesCounter, tparams, Location.Null), tparams, Modifiers.STATIC) { if (tparams != null) { mutator = new TypeParameterMutator(tparams, CurrentTypeParameters); } parent.DynamicSitesCounter++; }
public ProtoInstruction Attribute(MemberBase member, string value, string prefix) { return(new ProtoInstruction { PropertyAttribute = member, NodeType = NodeType.Attribute, PropertyAttributeText = value, Prefix = prefix, }); }
public void DeleteMember(MemberBase member) { Requires.NotNull(member); Requires.PropertyNotNegative(member, "MemberId"); using (var context = DataContext.Instance()) { var rep = context.GetRepository <MemberBase>(); rep.Delete(member); } }
/// <summary> /// 生成返回验证器 /// </summary> /// <param name="mb"></param> /// <param name="listValidators"></param> /// <param name="baseType"></param> /// <param name="dataTypeContent"></param> private static void BuildMemberValidatorsContent(MemberBase mb, ref List <Model.Core.Definitions.Entities.ValidatorBase> listValidators, ref EDataBaseType baseType, ref CommonDataType dataTypeContent) { switch (mb.MemberType) { case EMemberType.PrimaryMember: var _PrimaryMember = mb as PrimaryMember; if (_PrimaryMember.Content != null) { dataTypeContent = _PrimaryMember.Content as CommonDataType; baseType = dataTypeContent.BaseType; listValidators = dataTypeContent.Validators; } break; case EMemberType.CommonMember: var _CommonMember = mb as CommonMember; if (_CommonMember.Content != null) { dataTypeContent = _CommonMember.Content as CommonDataType; baseType = dataTypeContent.BaseType; listValidators = dataTypeContent.Validators; } break; case EMemberType.DataMember: var _DataMember = mb as DataMember; if (_DataMember.Content != null) { dataTypeContent = _DataMember.Content as CommonDataType; baseType = dataTypeContent.BaseType; listValidators = dataTypeContent.Validators; } break; case EMemberType.CalculateMember: var _CalculateMember = mb as CalculateMember; if (_CalculateMember.Content != null) { dataTypeContent = _CalculateMember.Content as CommonDataType; baseType = dataTypeContent.BaseType; listValidators = dataTypeContent.Validators; } break; case EMemberType.Property: var _PropertyMember = mb as Property; if (_PropertyMember.Content != null) { dataTypeContent = _PropertyMember.Content as CommonDataType; baseType = dataTypeContent.BaseType; listValidators = dataTypeContent.Validators; } break; } }
private static XamlMember GetDirective(MemberBase directive, XamlSchemaContext context) { var directiveName = TranslateDirectiveName(directive); var xamlMember = from ns in context.GetAllXamlNamespaces() let dir = context.GetXamlDirective(ns, directiveName) where dir != null select dir; return(new DirectiveAdapter(xamlMember.First())); }
private static XamlMember GetDirective(MemberBase directive, XamlSchemaContext context) { var directiveName = TranslateDirectiveName(directive); var xamlMember = from ns in context.GetAllXamlNamespaces() let dir = context.GetXamlDirective(ns, directiveName) where dir != null select dir; return new DirectiveAdapter(xamlMember.First()); }
public MemberBase GetOrCreate(string a_sName) { MemberBase mb = this.GetByName(a_sName); if (mb != null) { return(mb); } return((MemberBase) new MemberSpriteBitmap(a_sName)); }
public void UpdateMember(MemberBase member, int userId) { Requires.NotNull(member); Requires.PropertyNotNegative(member, "MemberId"); member.LastModifiedByUserID = userId; member.LastModifiedOnDate = DateTime.Now; using (var context = DataContext.Instance()) { var rep = context.GetRepository <MemberBase>(); rep.Update(member); } }
public void Add(MemberBase a_mb) { this._nameToMember[a_mb.Name] = a_mb; // DataRow row = m_dtMembers.NewRow(); // m_dtMembers.Rows.Add(row); // // row["Name"] = a_mb.Name; // row["Hash"] = a_mb.GetHashCode(); m_hashToMember[a_mb.GetHashCode()] = a_mb; m_aMembers.Add(a_mb); }
public void Remove(MemberBase a_mb) { if (a_mb.Name == null) { return; } this._nameToMember.Remove(a_mb.Name); // DataRow[] rows = m_dtMembers.Select("Hash = "+a_mb.GetHashCode()); // foreach (DataRow row in rows) // m_dtMembers.Rows.Remove(row); m_hashToMember.Remove(a_mb.GetHashCode()); m_aMembers.Remove(a_mb); }
public int AddMember(ref MemberBase member, int userId) { Requires.NotNull(member); member.CreatedByUserID = userId; member.CreatedOnDate = DateTime.Now; member.LastModifiedByUserID = userId; member.LastModifiedOnDate = DateTime.Now; using (var context = DataContext.Instance()) { var rep = context.GetRepository <MemberBase>(); rep.Insert(member); } return(member.MemberId); }
private IEnumerable <Instruction> ParseNestedProperty(MemberBase member) { yield return(Inject.StartOfMember(member)); SetNextInstruction(); foreach (var instruction in ParseInnerContentOfNestedProperty()) { yield return(instruction); } SkipTextNodes(); yield return(Inject.EndOfMember()); }
//public Endogine.BitmapHelpers.PixelManipulatorBase PixelManipulator //{ // get {return this.Member.PixelManipulator;} // set {this.Member.PixelManipulator = null;} //} //public Endogine.BitmapHelpers.Canvas Canvas //{ // get {return this.Member.C //} /// <summary> /// Look for a resource in this order: Animation, FrameSet, PicRef, Member. /// </summary> /// <param name="name"></param> public void SetGraphics(string name) { //EH.Instance.CastLib.Animations[name]; Endogine.Animation.BhAnimator an = (Endogine.Animation.BhAnimator) this["_anim"]; List <string> fs = EH.Instance.CastLib.FrameSets[name]; if (fs != null) { if (an != null) { an.FrameSet = name; } else { an = new Endogine.Animation.BhAnimator(this, name); } return; } PicRef pr = PicRef.Get(name); if (pr != null) { if (an != null) { an.Dispose(); } this.PicRef = pr; return; } MemberBase mb = EH.Instance.CastLib.GetByName(name); if (mb != null && mb is MemberSpriteBitmap) { this.Member = (MemberSpriteBitmap)mb; return; } this.MemberName = name; }
private static MetaDataMethod GetMethodContent(MemberBase mb) { var item = mb as Method; string parms = string.Empty, parmsBind = string.Empty; #region StringBuilder methodArg = new StringBuilder(); StringBuilder methodArgBind = new StringBuilder(); StringBuilder argBind = new StringBuilder(); foreach (var child in item.Children) { var para = child as Parameter; //var DataType = BuildCommonMethod.GetTypeNameByIon(para.DataType.Value); var DataType = "any"; if (child.MemberType == EMemberType.Parameter) { methodArg.Append(para.Name + ":" + DataType + ","); string bindProp = para.Path == null ? "" : para.Path.Replace("CurrentItem", "SelectedItem"); argBind.Append("{ name:\"" + para.Name + "\"," + "bindProperty:\"" + bindProp + "\" },"); } } if (!string.IsNullOrEmpty(argBind.ToString())) { methodArgBind.Append(argBind.ToString().Substring(0, argBind.ToString().Length - 1)); parmsBind = methodArgBind.ToString(); } if (!string.IsNullOrEmpty(methodArg.ToString())) { parms = methodArg.ToString().Substring(0, methodArg.Length - 1); } #endregion var MethodMember = new MetaDataMethod { Name = item.Name, Title = item.Title, Body = item.Body == null ? "" : item.Body, Params = parms, ParamsBind = parmsBind }; return(MethodMember); }
private static string GetParameterString(MemberBase mb) { StringBuilder result = new StringBuilder(); if (mb.MemberType == EMemberType.Parameter) { var para = mb as Parameter; string bindPath = para.Path == null ? "" : para.Path.Replace("CurrentItem", "SelectedItem"); string paraType = "InOut"; if (para.ParameterType == Model.Core.Definitions.Screens.Members.EParameterType.InArgument) { paraType = "In"; } else if (para.ParameterType == Model.Core.Definitions.Screens.Members.EParameterType.OutArgument) { paraType = "Out"; } result.AppendLine("" + para.Name + ": { name:\"" + para.Name + "\",type:ParameterType." + paraType + ",bindProperty:\"" + bindPath + "\" },"); } return(result.ToString()); }
/// <summary> /// 当前绑定的属性是否是导航属性 /// </summary> /// <param name="screenDef"></param> /// <param name="bindPath"></param> /// <returns></returns> public static bool bindNavigatorMember(this ControlBase controlBase, ScreenDefinition screenDef, string bindPath, int pathLevel = 3) { bool isNavigatorMember = false; string datasetName = bindPath.Split('.')[0]; var dataDataSet = (from t in screenDef.Children where (t.MemberType == EMemberType.DataSet || t.MemberType == EMemberType.Objects) && t.Name == datasetName select t).FirstOrDefault(); if (dataDataSet != null) { var childItems = (from t in dataDataSet.Children where t.MemberType == EMemberType.CurrentItem || t.MemberType == EMemberType.SelectedItem select t.Children).FirstOrDefault(); if (childItems != null) { var path = bindPath; if (pathLevel == 4) { path = bindPath.Split('.')[0] + "." + bindPath.Split('.')[1] + "." + bindPath.Split('.')[2]; } var dataMember = (from t in childItems where t.FullName == path select t).FirstOrDefault(); if (dataMember != null) { if (pathLevel == 4) { MemberBase childMB = dataMember as MemberBase; var childMBs = (from t in childMB.Children where t.FullName == bindPath select t).FirstOrDefault(); if (childMBs != null) { if (childMBs.MemberType == EMemberType.NavigateMember || childMBs.MemberType == EMemberType.DataSet) { return(isNavigatorMember = true); } } } else if (dataMember.MemberType == EMemberType.NavigateMember) { return(isNavigatorMember = true); } } } } return(isNavigatorMember); }
private MemberBase GetActualMemberFromMemberSpecifiedInInstruction(MemberBase specifiedMember) { if (IsLevelOneAndThereIsRootInstance && !specifiedMember.IsDirective && rootInstanceXamlType != null) { var attachable = specifiedMember as AttachableMember; MemberBase actualMember; if (attachable != null) { actualMember = attachable.DeclaringType.GetAttachableMember(specifiedMember.Name); } else { actualMember = rootInstanceXamlType.GetMember(specifiedMember.Name); } return(actualMember); } return(specifiedMember); }
private void SetCommuterStateAccordingToDirective(MemberBase memberBase) { switch (GetDirectiveKind(memberBase)) { case DirectiveKind.Items: if (StateCommuter.HasParent && !StateCommuter.ParentIsOneToMany) { throw new ParseException("Cannot assign a more than one item to a member that is not a collection."); } if (!StateCommuter.Current.IsGetObject) { AccommodateLevelsForIncomingChildren(); } break; case DirectiveKind.Initialization: StateCommuter.ValueProcessingMode = ValueProcessingMode.InitializationValue; break; case DirectiveKind.Key: StateCommuter.ValueProcessingMode = ValueProcessingMode.Key; break; case DirectiveKind.MarkupExtensionArguments: StateCommuter.Current.CtorArguments = new Collection<ConstructionArgument>(); StateCommuter.ValueProcessingMode = ValueProcessingMode.ConstructionParameter; break; case DirectiveKind.Name: StateCommuter.ValueProcessingMode = ValueProcessingMode.Name; break; case DirectiveKind.UnknownContent: AccommodateLevelsForIncomingChildren(); break; } }
private MemberBase GetActualMemberFromMemberSpecifiedInInstruction(MemberBase specifiedMember) { if (IsLevelOneAndThereIsRootInstance && !specifiedMember.IsDirective && rootInstanceXamlType != null) { var attachable = specifiedMember as AttachableMember; MemberBase actualMember; if (attachable != null) { actualMember = attachable.DeclaringType.GetAttachableMember(specifiedMember.Name); } else { actualMember = rootInstanceXamlType.GetMember(specifiedMember.Name); } return actualMember; } return specifiedMember; }
private IEnumerable<Instruction> ParseCollectionInsideThisProperty(MemberBase member) { yield return Inject.StartOfMember(member); if (IsBeginingOfImplicitCollection) { yield return Inject.GetObject(); yield return Inject.Items(); foreach (var instruction in ParseElements()) { yield return instruction; } yield return Inject.EndOfMember(); yield return Inject.EndOfObject(); } else { foreach (var xamlInstruction in ParseNonEmptyElement()) { yield return xamlInstruction; } } yield return Inject.EndOfMember(); }
public StartMemberCommand(StateCommuter stateCommuter, MemberBase member) : base(stateCommuter) { this.member = member; }
private IEnumerable<Instruction> ParseNestedProperty(MemberBase member) { yield return Inject.StartOfMember(member); SetNextInstruction(); foreach (var instruction in ParseInnerContentOfNestedProperty()) { yield return instruction; } SkipTextNodes(); yield return Inject.EndOfMember(); }
protected bool Equals(MemberBase other) { return string.Equals(Name, other.Name) && XamlType.Equals(other.XamlType); }
public static Instruction StartOfMember(MemberBase member) { return new Instruction(InstructionType.StartMember, member); }