/// <summary> /// 安装下一个类型 /// </summary> protected override void nextCreate() { Type modelType; AutoCSer.Sql.ModelAttribute modelAttribute = Type.Type.customAttribute <AutoCSer.Sql.ModelAttribute>(out modelType); if (modelAttribute != null) { AutoCSer.Net.TcpStaticServer.ServerAttribute serverAttribute = AutoCSer.Metadata.TypeAttribute.GetAttribute <AutoCSer.Net.TcpStaticServer.ServerAttribute>(Type, false); if (serverAttribute != null && serverAttribute.ServerName != null && !serverAttribute.IsRemoteLinkType && serverAttribute.IsRemoteLink && (RemoteLinkType = TcpStaticServer.Generator.GetRemoteLinkType(Type)) != null) { LeftArray <TcpStaticServer.Generator.RemoteMethod> remoteMethods = new LeftArray <TcpStaticServer.Generator.RemoteMethod>(0); foreach (MethodIndex method in MethodIndex.GetMethods <AutoCSer.Net.TcpStaticServer.MethodAttribute>(Type, serverAttribute.GetMemberFilters, false, serverAttribute.IsAttribute, serverAttribute.IsBaseTypeAttribute)) { if (!method.Method.IsGenericMethodDefinition) { AutoCSer.Net.TcpStaticServer.RemoteMemberAttribute remoteAttribute = method.GetSetupAttribute <AutoCSer.Net.TcpStaticServer.RemoteMemberAttribute>(false); if (remoteAttribute != null && !remoteAttribute.IsClientRemoteMember) { MethodParameter[] parameters = method.Parameters; if (parameters.Length >= 1 && parameters[0].ParameterType == RemoteLinkType.ParameterType) { remoteMethods.Add(new TcpStaticServer.Generator.RemoteMethod { Type = Type, Method = method, MethodParameters = parameters, Attribute = remoteAttribute }); } } } } LeftArray <SqlModel.Generator.LogMember> logMembers = new LeftArray <SqlModel.Generator.LogMember>(0); foreach (MemberIndex member in MemberIndex.GetMembers(modelType, modelAttribute.MemberFilters)) { if (!member.IsIgnore) { AutoCSer.Sql.MemberAttribute attribute = member.GetAttribute <AutoCSer.Sql.MemberAttribute>(false); if (modelAttribute.LogServerName != null) { AutoCSer.Sql.LogAttribute logAttribute = member.GetAttribute <AutoCSer.Sql.LogAttribute>(false); if (logAttribute != null) { SqlModel.Generator.LogMember logMember = new SqlModel.Generator.LogMember { Member = member, Attribute = logAttribute, MemberAttribute = attribute }; if (modelAttribute.LogServerName != null && logMember.IsProxy) { logMembers.Add(logMember); foreach (TcpStaticServer.Generator.RemoteMethod remoteMethod in remoteMethods) { if (remoteMethod.Attribute.MemberName == member.MemberName) { remoteMethod.Member = member; break; } } } } } } } RemoteMethods = remoteMethods.GetFindArray(value => value.Member != null); LogMembers = logMembers.Length != 0 && (modelAttribute.CacheType != AutoCSer.Sql.Cache.Whole.Event.Type.Unknown && modelAttribute.CacheType != AutoCSer.Sql.Cache.Whole.Event.Type.CreateMemberKey) ? logMembers.ToArray() : EmptyArray <SqlModel.Generator.LogMember> .Array; if ((LogMembers.Length | RemoteMethods.Length) != 0) { //create(true); IsRemoteMember = RemoteMethods.Length != 0 && TcpStaticServer.Generator.RemoteMemberTypes.Add(Type); CSharpTypeDefinition definition = new CSharpTypeDefinition(Type, true, false); _code_.Length = 0; create(false); Coder.Add(definition.Start + _partCodes_["SERVER"] + definition.End); TcpStaticServer.Generator.AddClientCode(new TcpStaticServer.Generator.ClientCode { Type = Type, Attribute = serverAttribute, Code = definition.Start + _partCodes_["CLIENT"] + definition.End, SegmentationCode = definition.Start + _partCodes_["CLIENTCALL"] + definition.End }); } } } }
internal static void CopyFrom(this AutoCSer.Net.TcpStaticServer.ServerAttribute value, AutoCSer.Net.TcpStaticServer.ServerAttribute copyValue) { AutoCSer.MemberCopy.Copyer <AutoCSer.Net.TcpStaticServer.ServerAttribute> .Copy(value, copyValue, copyMemberMap); }