المفاهيم
هنفهم إيه؟ هنتعامل مع نظام قديم أو شريك خارجي من غير ما تفاصيل بروتوكوله تدخل في قلب الدومين. هنمشي من قراءة العقد، لاستهلاك الخدمة، ثم عزلها وترحيل أجزاء منها مع الحفاظ على السلوك.
قبل ما تبدأ: يكفي فهم وطلب/رد، ووجود خدمة تملك بيانات أو عملية. بروتوكول رسائل له عقد؛ وصف للعمليات وأنواع البيانات؛ و صيغة نص منظمة لنقلها. لو المصطلحات جديدة ابدأ بأول بطاقتين، وبعدها قارن مسارات الترحيل.
المصطلحات اللي تحتها خط منقّط تقدر تضغط عليها لمعرفة معناها، وترجع تكمل من نفس مكانك.
#SOAP و WSDL و XML: افهم العقد الأولSOAP, WSDL and XML: start with the contract
ممكن متجر حديث يحتاج يكلّم نظام فواتير قديم. بروتوكول رسائل مبني على ، مش مجرد أي XML بيتبعت على . الرسالة فيها Envelope، وHeader اختياري، وBody للعملية أو Fault. بيوصف العمليات والرسائل والـ bindings والـ endpoints، و بيوصف أنواع الداتا.
<!-- (1) SOAP 1.1 envelope namespace -->
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<!-- (2) Operation namespace belongs to the service contract -->
<GetInvoice xmlns="urn:store:invoices">
<invoiceId>42</invoiceId>
</GetInvoice>
</s:Body>
</s:Envelope>
- (1) ده namespace بتاع SOAP 1.1؛ SOAP 1.2 ليه namespace وHTTP content type مختلفين.
- (2) العملية والـ invoiceId هنا جوه namespace بتاع الخدمة. الـ prefix نفسه قابل للتغيير، لكن مهم.
اختار binding مطابق للـ WSDL. SOAP مش بيفرض HTTP بس، وWS-Security مش هو نفسه . خليك مع العقد الموجود لو فيه consumers معتمدين عليه؛ أو مش بديل مباشر على نفس الـ wire.
#استهلاك SOAP من .NET 10Consuming SOAP from .NET 10
بدل تركيب بإيدك، ولّد proxy من موثوق باستخدام dotnet-svcutil أو Web Service Reference في Visual Studio. الأداة بتضيف System.ServiceModel packages المناسبة، زي System.ServiceModel.Http وSystem.ServiceModel.Primitives. ده دعم للـ client؛ مش WCF server القديم.
dotnet tool install --global dotnet-svcutil
# (1) Local, reviewed WSDL and its imported schemas
dotnet-svcutil ./contracts/invoices.wsdl
dotnet restore
using System.ServiceModel;
// (2) Generated names depend on your WSDL.
var binding = new BasicHttpsBinding
{
SendTimeout = TimeSpan.FromSeconds(15),
MaxReceivedMessageSize = 1_000_000
};
var endpoint = new EndpointAddress("https://partner.example/Invoices.svc");
var client = new InvoiceServiceClient(binding, endpoint);
try
{
var result = await client.GetInvoiceAsync(42); // (3)
client.Close();
}
catch
{
client.Abort(); // (4)
throw;
}
- (1) احتفظ بالعقد والـ schemas في version control، وراجع فرق الـ generated code عند التحديث.
- (2) المثال بيفترض proxy اسمه InvoiceServiceClient وعملية بتاخد int؛ غيّرهم حسب Reference.cs. BasicHttpsBinding مناسب لعقد 1.1 على ، مش لكل bindings.
- (3) الاستدعاء async، لكن الـ generated method ممكن ماتاخدش CancellationToken. SendTimeout بيحدد مهلة العملية هنا؛ اختبر توافق auth والـ security والـ quotas مع الطرف التاني.
- (4) لو الاستدعاء أو Close فشل، Abort بينضّف الـ channel. ماتعملش reuse لـ faulted client أو مشاركة concurrent من غير ضمان موثّق.
المصدر: دليل Microsoft لتوليد WCF client.
#XML من برّه: parsing بحدود واضحةBonusParsing external XML safely
اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.
ملف ممكن يحاول يقرأ external entities أو يستهلك memory ضخمة. لما تعمل parsing بنفسك، امنع DTD وحط حد للحجم. استخدم parser أو serializer بدل string concatenation علشان escaping والـ namespaces.
using System.Xml;
using System.Xml.Linq;
var settings = new XmlReaderSettings
{
DtdProcessing = DtdProcessing.Prohibit, // (1)
XmlResolver = null,
MaxCharactersInDocument = 1_000_000 // (2)
};
using var reader = XmlReader.Create(inputStream, settings);
var document = XDocument.Load(reader); // (3)
- (1) أي DTD هيترفض، والـ resolver مش هيفتح ملفات أو عناوين خارجية.
- (2) الحد مثال لازم يتظبط على العقد، ومعاه حدود transport وحجم فك الضغط.
- (3) XDocument بيحمّل المستند في memory؛ للملفات الكبيرة استخدم XmlReader بشكل streaming. Parsing مش بديل لـ validation ولا business validation.
#Anti-corruption layer: مترجم على الحدودAn anti-corruption layer at the boundary
- نظام قديم يرجع العميل كحقول مختصرة وأكواد غريبة عن نموذج تطبيقك. لو نشرت الأكواد في كل طبقاتك، أي تغيير عنده يؤثر في أجزاء كثيرة عندك.
- Anti-corruption layer محول عند الحد: يقرأ شكل النظام القديم، يتحقق منه، ثم يحوله لمفاهيم تطبيقك. مثل تحويل كود حالة قديم إلى حالة طلب معروفة عندك.
- حدد كيف تتعامل مع قيمة لا تعرفها أو فشل مؤقت، ولا تحول كل خطأ إلى نجاح افتراضي. الهدف حماية معنى نموذجك، مش مجرد تغيير أسماء الخصائص.
لو النظام الخارجي بيقول status اسمه X9، ماتخليش X9 يبقى مفهوم في كل الـ domain. الـ adapter بيترجم الشكل، والـ anti-corruption layer كمان بترجم المعنى: العملة، ووحدة الكمية، والـ time zone، والأخطاء.
public record InvoiceStatus(bool Paid);
public record LegacyInvoice(string StateCode);
public interface ILegacyInvoices
{
Task<LegacyInvoice> FetchAsync(int id, CancellationToken ct);
}
public interface IInvoiceStatus
{
Task<InvoiceStatus> GetAsync(int id, CancellationToken ct);
}
public sealed class InvoiceAdapter(ILegacyInvoices legacy) : IInvoiceStatus
{
public async Task<InvoiceStatus> GetAsync(int id, CancellationToken ct)
{
var dto = await legacy.FetchAsync(id, ct); // (1)
return dto.StateCode switch // (2)
{
"X9" => new(true),
"N0" => new(false),
_ => throw new InvalidDataException("Unknown invoice state")
};
}
}
- (1) ILegacyInvoices هو seam للـ transport wrapper؛ هو اللي يعرف proxy الـ الحقيقي وإمكانية الإلغاء عنده.
- (2) بنحوّل القيم لعقدنا وبنرفض الحالة المجهولة بدل اعتبارها unpaid بالغلط. المستهلك بيعرف IInvoiceStatus بس.
اعمل contract tests للـ mapping، وسجّل correlation ID من غير تسريب بيانات حساسة. الطبقة تكلفتها كود إضافي؛ ماتعملش عشر طبقات forwarding لو الموديلات بالفعل متطابقة وبسيطة.
#WCF server: CoreWCF ولا gRPC؟Moving a WCF server: CoreWCF or gRPC?
نقل target framework مش هيشغّل server الأصلي على 10. لو لازم تحافظ على clients، قيّم CoreWCF واختبر الـ bindings والـ security والـ behaviors المطلوبة. لو كل المستهلكين ممكن يتغيروا، اختيار لعقد جديد، لكنه محتاج client regeneration وتغيير الـ wire protocol.
| قديم | مسار حديث | التكلفة |
|---|---|---|
| WCF SOAP server | CoreWCF مع عقد متوافق قدر الإمكان | تحقق من توافق الميزات؛ مش drop-in كامل |
| Internal contract | gRPC وProtobuf | تغيير العملاء والـ hosting والـ observability |
| SOAP consumer | System.ServiceModel client packages | التوافق بيتحدد بالـ binding المطلوب |
ابدأ بتجربة عملية واحدة فيها أصعب security requirement. ماتخلطش ترحيل الـ runtime وإعادة تصميم كل العقود في خطوة واحدة. ممكن تفضل SOAP facade قدام implementation جديد لحد ما العملاء يهاجروا.
#Strangler fig و YARP: انقل route ورا routeStrangler fig with YARP: migrate route by route
إعادة كتابة نظام شغّال بالكامل بتأخر الـ feedback وبتجمع المخاطرة. حط entry point قدام القديم والجديد، وانقل feature كاملة بالتدريج. في المثال بيخدم routes الجديدة محلياً، و بيحوّل الباقي للقديم.
// Package: Yarp.ReverseProxy; configuration shown below.
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); // (1)
var app = builder.Build();
app.MapGet("/products/{id:int}", (int id) => new { Id = id }); // (2)
app.MapReverseProxy(); // (3)
app.Run();
{
"ReverseProxy": {
"Routes": {
"fallback": {
"ClusterId": "legacy",
"Order": 1000,
"Match": { "Path": "{**catch-all}" }
}
},
"Clusters": {
"legacy": {
"Destinations": {
"primary": { "Address": "https://legacy.example/" }
}
}
}
}
}
- (1) بنقرأ routes والـ destinations من configuration.
- (2) ده route توضيحي للجزء الجديد؛ الـ response الحقيقي هييجي من application service.
- (3) fallback بأولوية أقل بيكمّل الطلبات القديمة. Endpoint selection بيعتمد على الـ route والـ Order، مش ترتيب السطور بس.
حدّد ملكية الكتابة للداتا، وتوافق الـ schemas، والـ cookies والـ session والـ authentication، وخطة rollback. Shadow reads تنفع للمقارنة؛ ماتعملش shadow writes تدفع مرتين. راقب traffic القديم وحدّد شرط تقاعده.
المصدر: ترحيل ASP.NET تدريجياً.
#من .NET Framework لـ .NET 10: خطة قابلة للتحققA verifiable .NET Framework to .NET 10 migration
- اعمل inventory للـ dependencies والـ Windows والـ integration contracts، وسجّل baseline للأخطاء والأداء.
- ثبّت السلوك بـ characterization tests، واختار slice صغيرة بقيمة واضحة وخطة rollback.
- انقل الـ leaf libraries المطلوبة للـ slice الأول.
netstandard2.0جسر للـ shared libraries مع Framework؛ مش runtime جديد. عملياً Framework 4.7.2 أو أحدث أفضل لتجنب مشاكل التوافق القديمة.netstandard2.1مش مدعوم في Framework. - استبدل حدود الـ hosting والـ config، وبعدها اختبر end-to-end والـ deployment والـ load قبل تحويل traffic.
| قديم | حديث | راجع إيه |
|---|---|---|
| System.Web | وHttpContext و | request lifecycle والـ session والـ auth؛ adapters مؤقتة حسب الحاجة |
| EF6 | لما يكون له عائد | translation والـ tracking والـ migrations؛ مش rename packages |
| web.config application settings | appsettings.json وenvironment variables وOptions | الـ secrets برّه الملفات؛ web.config ممكن يفضل لتشغيل |
| Framework-only library | netstandard2.0 أو multi-target | كل dependencies لازم تكون متوافقة؛ كود التطبيق الجديد يستهدف net10.0 |
#Characterization tests و seamsCharacterization tests and seams
قبل refactoring، لازم تعرف الكود بيعمل إيه فعلاً، حتى لو السلوك غريب. Characterization test بتوثّق السلوك الحالي، وseam نقطة تقدر تبدّل عندها dependency زي الوقت أو من غير تغيير الـ business logic.
// TimeProvider is the seam; this example captures an existing date rule.
public sealed class InvoiceDates(TimeProvider clock)
{
public DateOnly Today() =>
DateOnly.FromDateTime(clock.GetUtcNow().UtcDateTime); // (1)
}
public sealed class FixedClock : TimeProvider
{
public override DateTimeOffset GetUtcNow() =>
new(2026, 10, 22, 0, 0, 0, TimeSpan.Zero);
}
[Fact]
public void PreservesUtcInvoiceDate()
{
var dates = new InvoiceDates(new FixedClock()); // (2)
Assert.Equal(new DateOnly(2026, 10, 22), dates.Today());
}
- (1) بنحافظ على قاعدة الحالية؛ مش بنغيّرها للتوقيت المحلي وسط الـ refactor.
- (2) test بـ xUnit ووقت ثابت، فمش بيتكسر مع منتصف الليل. في الكود القديم سجّل النتيجة الفعلية قبل إدخال الـ seam وبعده.
للـ golden master طبّع القيم غير الثابتة فقط، زي generated IDs، وماتطبّعش اختلافات حقيقية. السلوك الغلط يتسجّل بوضوح ويتصلح كتغيير منفصل متفق عليه؛ characterization مش موافقة دائمة على bug.
#التكامل الموثوق: outbox و idempotency و reconciliationReliable integration: outbox, idempotency and reconciliation
حفظ order وبعت رسالة عمليتين منفصلتين: الـ process ممكن يقع بينهم. اكتب order و row في نفس local ، وخلي dispatcher يبعت بعدين. الإرسال ممكن يتكرر لو وقع بعد وصول الرسالة وقبل تسجيل النجاح.
(1) Transaction: save Order + Outbox(MessageId, OrderId, Version, Payload)
(2) Dispatcher: lease pending row, send with stable MessageId, record success
(3) Receiver transaction: unique Inbox(MessageId) + apply business update
(4) Reconciliation: compare by business key, version, amount and currency
- (1) الاتنين يتعملهم commit أو rollback مع بعض في نفس database transaction.
- (2) lease بيقلل تنافس العمال، لكنه مش بيمنع التكرار؛ retry محدود مع backoff وjitter للأخطاء المؤقتة بس.
- (3) unique constraint والـ effect في نفس transaction يحموا من double processing؛ الدفع الخارجي محتاج نفس key عند المزود.
- (4) قارن الحالة الفعلية، واعمل repair آمن أو alert. حافظ على الترتيب المطلوب لكل order، مش ترتيب عالمي بلا داعي.
Outbox مش exactly-once delivery ولا distributed transaction. لو الشريك مابيدعمش deduplication، timeout يبقى unknown outcome: اسأل عن النتيجة أو دخّلها reconciliation بدل retry أعمى. راقب عمر أقدم رسالة، والـ retries، والرسائل العالقة.
#CSV و SFTP و batch jobsCSV, SFTP and batch processing
مش كل partner عنده . اتفق على file contract: encoding، وdelimiter، وquoted fields، و version، وtime zone، وbusiness keys، وrow counts والـ checksum. نقل فوق ؛ مختلف عن FTPS اللي بيستخدم .
- تحقق من SSH host key، وارفع باسم مؤقت، وبعد اكتمال النقل اعمل rename متفق عليه أو completion marker.
- سجّل file ID والـ checksum؛ اعمل staging وvalidation، واعزل الصفوف المرفوضة مع سبب ورقم سطر.
- طبّق batches صغيرة بـ unique business keys وcheckpoint دائم. سجّل checkpoint بعد commit؛ لو حصل crash قبل تسجيله، إعادة الدفعة لازم تكون آمنة.
- اطلع acknowledgment فيه عدد المقبول والمرفوض، واعمل reconciliation للإجماليات. حدد هل الرفض جزئي ولا الملف كله atomic.
File: invoices-20261022-v1.csv
FileId: stable partner batch identifier
Staging: FileId + RowNumber + BusinessKey + ValidationStatus
Checkpoint: FileId + LastCommittedBatch
Result: accepted count + rejected count + totals by currency
ماتستخدمش Split(',') كـ parser عام؛ commas وnewlines ممكن يكونوا جوه quotes. Streaming بيحدّ حجم الصفوف المحمّلة، لكن HashSet لكل المفاتيح لسه ممكن يملأ memory. استخدم staging database أو external sort عند الحاجة.
BackgroundService مناسب worker جوه host، لكنه مش durable scheduler لوحده. Hangfire أو Quartz.NET أو scheduler خارجي ممكن يديروا المواعيد حسب إعداداتهم، لكن jobs تفضل . حدد منع التداخل بين instances، والـ misfires، والتوقيت الصيفي، والـ cancellation، والـ retry، والتنبيه على job مااشتغلش. ماتشغّلش job مهم بـ Task.Run جوه request.
أسئلة الانترفيو
مفيش نتايج
راجع فهمك
ليه الاختيار ده مناسب؟ إمتى ممكن ماينفعش؟ وإيه اللي هيتغير لو الحمل زاد أو ظهر فشل؟
26.1What are SOAP, WSDL and XSD?Junior
شكل الرسالة وقواعدها، و عقد الخدمة والـ operations والـ binding، و أنواع . مش أي XML endpoint يبقى SOAP، ومش كل SOAP binding مدعوم في أي client.
I separate the message protocol from its description. defines an envelope with a body, optional headers and faults. describes the service operations, message contracts, bindings and endpoints, while defines the XML types those messages use. I usually generate a typed client from the WSDL rather than build envelopes manually. Before integrating, I check the SOAP version, binding and security requirements because a generated proxy alone does not guarantee interoperability.
26.2Why do XML namespaces matter?Junior
هوية العنصر namespace مع local name. تغيير prefix عادي لو بيشاور لنفس URI، لكن حذف namespace مش تعديل شكلي.
I treat an element's identity as its namespace plus local name. Two elements called Invoice can represent different contracts if their namespace URIs differ. Conversely, changing a prefix from a to b does not change meaning when both map to the same URI. When debugging , I compare qualified names and schemas rather than just the visible tag spelling. I use XML or generated serializers so namespace handling and escaping are explicit.
26.3How do you consume a SOAP service in .NET 10?Mid
ولّد proxy بـ dotnet-svcutil من عقد موثوق، وراجع System.ServiceModel packages والـ binding. اعزله في adapter واختبر faults والـ timeouts والـ security.
I generate a proxy from a trusted using dotnet-svcutil or Visual Studio's Web Service Reference. The generated code uses System.ServiceModel client packages. I inspect the generated operations and configure the appropriate binding, endpoint, authentication, timeouts and message limits. I keep those types behind an adapter implementing our own interface. I also test faults and timeout behavior, and close healthy channels or abort failed ones instead of reusing a faulted client.
26.4Does modern .NET support WCF servers?Mid
server الأصلي مش جزء من 10. CoreWCF مسار للحفاظ على ، و مسار لعقد جديد؛ لازم تختبر دعم كل feature محتاجها.
I distinguish client packages from the original WCF server runtime. Modern can consume supported contracts with System.ServiceModel clients, but it does not host the original Framework WCF server. I evaluate CoreWCF when existing SOAP clients must remain compatible, checking bindings, security and behaviors individually. If we control all consumers, I may design a contract instead. That changes the wire protocol and clients, so it is a separate migration decision.
26.5What is an anti-corruption layer?Mid
حد ترجمة يحافظ على مفاهيم الـ domain. مش mapping بس: لازم يفهم الحالات ووحدات القياس والأخطاء والتوقيت.
I use an anti-corruption layer to keep a legacy or partner model from spreading into our domain. It contains adapters and translation rules for data, behavior and failures. For example, an external invoice status code becomes our own meaningful status, and unknown codes are handled explicitly. This gives consumers a stable interface and keeps partner-specific changes localized. I test the mapping against real contract examples, while avoiding unnecessary abstraction when the integration is already simple.
26.6What is the strangler fig pattern?Mid
نقل تدريجي للـ capabilities مع entry point يوجّه للقديم والجديد. لازم ملكية كتابة واضحة وخطة لتقاعد القديم، وإلا الاتنين هيفضلوا للأبد.
I migrate one capability at a time while old and new implementations coexist behind a routing boundary. A proxy sends migrated routes to the new application and leaves the rest on the legacy system. Each slice has tests, observability and a rollback plan. I also define data ownership and cross-cutting concerns such as authentication before moving traffic. The pattern reduces the size of each change, but coexistence costs money and complexity, so I track explicit legacy retirement criteria.
26.7What would your .NET Framework migration plan look like?Senior
ابدأ بالمخاطر والعقود والـ baseline، وبعدها slice صغيرة والـ leaf libraries اللازمة. System.Web وEF6 والـ config محتاجين تقييم مستقل، مش search and replace.
I start with dependency and platform assessment, production baselines and characterization tests. Then I choose a small business slice and upgrade its leaf libraries, using netstandard2.0 or multi-targeting only where sharing with Framework is needed. I replace System.Web boundaries, evaluate hosting, and validate query behavior and configuration changes separately. I use migration tooling for mechanical edits, review its output, and move traffic gradually with rollback. A successful build is only the beginning of validation.
26.8What is a characterization test?Junior
بيثبت السلوك الحالي قبل التغيير، مش بالضرورة السلوك المثالي. أي bug معروف يتوثق ويتصلح بتغيير منفصل بدل إخفائه في refactor.
I write characterization tests to capture what existing code currently does before changing its structure. They are useful when requirements are incomplete or behavior has evolved over years. I select representative inputs, record outputs and side effects, and make unstable values deterministic where possible. The tests may preserve a known defect temporarily, so I label that explicitly and change it in a separate agreed fix. Their purpose is to expose accidental behavior changes during modernization.
26.9What is a seam in legacy code?Mid
نقطة تبديل dependency زي الساعة أو الدفع. دخّل أصغر seam محتاجه، وثبّت السلوك قبل وبعد، بدل rewrite واسع علشان تعمل test واحد.
I think of a seam as a place where I can change a dependency's behavior without rewriting the business logic being tested. Constructor injection for a clock, a file reader or a payment client is a common example. I introduce the smallest useful seam, preserve behavior with characterization tests, and supply a deterministic test implementation. I avoid a broad redesign just to add one test, because that increases the unverified change before the safety net exists.
26.10Why is migrating EF6 to EF Core more than renaming packages?Senior
نفس مش ضمان لنفس أو نفس الأداء. راجع relationships والـ tracking والـ migrations والـ والـ SQL الفعلي. النقل مش إجباري في نفس مرحلة الـ runtime.
I treat as a different implementation rather than an EF6 package upgrade. Query translation, relationship conventions, loading, tracking and migrations can differ, so code that compiles may behave differently or issue more queries. I compare representative results, generated and performance against a real database. I also plan evolution independently so both application versions remain compatible. Depending on dependencies, I may postpone the ORM migration to avoid combining too many risks.
26.11How do you prevent lost integration messages?Mid
order والـ في نفس ، وبعدها dispatcher. ده يمنع فجوة الـ dual write المحلية، لكن الإرسال متكرر ومحتاج deduplication وتنبيه لو الرسائل علقت.
I save the business change and an record in the same local database . A dispatcher reads pending records, sends them with a stable message identifier and marks them complete after acknowledgment. If it crashes after sending, the record can be sent again, so the receiver must deduplicate and apply its effect atomically where possible. I monitor backlog age and failed attempts, and keep a repair path for messages that cannot progress automatically.
26.12A payment call timed out. Should you retry it?Senior
timeout معناه النتيجة مجهولة؛ مش دليل إن الدفع فشل. استخدم نفس key أو status query. من غير دعم من الطرف التاني، اعزل الحالة للمراجعة.
I do not interpret a timeout as proof that the payment failed. The provider may have completed the charge before the response was lost. I reuse the original key if the provider supports it and understands its retention rules, or query the payment by a stable business reference. Without either capability, I record an unknown outcome and reconcile before resending. A generic retry policy can otherwise turn a temporary network problem into a duplicate charge.
26.13Why do integrations need reconciliation if they already use an outbox?Senior
بيغطي تسجيل وإرسال الحدث، مش كل mapping bug أو تعديل يدوي أو شريك ضيّع تحديث. Reconciliation يقارن الحالة والإجماليات ويصلّح بقواعد آمنة.
I use an to protect local event recording, but it cannot prove that both systems represent the same final business state. Mapping defects, manual edits, rejected records and partner-side failures can still create differences. Reconciliation compares stable business keys, versions, statuses and monetary totals after allowing for expected delay. It classifies discrepancies and either repairs them idempotently or raises an actionable exception. I audit repairs so reconciliation does not become an invisible source of new changes.
26.14What is the difference between SFTP and FTPS?Junior
فوق ، وFTPS هو FTP مع . اتفق مع الشريك على البروتوكول وطريقة التحقق من هوية السيرفر، مش رقم port وبس.
I check the actual protocol rather than treating secure file transfer as one interchangeable option. is a file-transfer protocol over , while FTPS is FTP secured with . They use different clients and server configurations. For SFTP I verify the server's host key and use managed credentials or keys. Encryption protects the connection, but I still need file completeness checks, duplicate detection and acknowledgments to know whether the business import succeeded.
26.15How would you import a large CSV safely?Mid
عقد واضح وparser يدعم quotes، وstaging وvalidation وbatch commits. خلي إعادة الملف أو الدفعة آمنة، وطلع rejected rows وإجماليات قابلة للمراجعة.
I agree the , encoding, quoting rules and file completion protocol first. I stream records through a proper parser into staging, validate them, and apply bounded batches with stable business keys. I track file identity and durable progress so replay after a crash is safe. Invalid records go to a quarantine with clear reasons. Finally I return accepted and rejected counts and reconcile totals, with an explicit policy for partial acceptance versus rejecting the entire file.
26.16Is BackgroundService enough for reliable scheduled jobs?Mid
بيشغّل worker بس؛ restart ممكن يضيّع timer أو state في memory. الجدولة الدائمة محتاجة durable state وتعامل مع التداخل والـ misfires والتنبيه.
I use BackgroundService as a hosting mechanism, not as a guarantee of durable scheduling. In-memory timers and progress disappear on restart, and multiple application replicas may start the same job. Depending on the requirement, I use a scheduler or durable job store and define overlap protection, retry policy, missed-run behavior and time-zone rules. The job itself remains and checkpointed, because even a durable scheduler can deliver work more than once after failures.
26.17How would you roll back a partially migrated feature?Senior
تحويل route بس مش كفاية لو الجديد كتب داتا القديم مش بيفهمها. استخدم expand-contract وملكية كتابة واحدة، وحدد نقطة الرجوع قبل تفعيل التغيير.
I design rollback before routing production traffic. The old application must still understand data written by the new version, so I use compatible changes and delay destructive cleanup. I define one writer for each business operation and verify authentication and session behavior through the proxy. If metrics or business checks regress, I can route the slice back while preserving completed writes. For irreversible changes, I need a recovery or compensation plan rather than pretending a route switch reverses them.
26.18How do you handle ordering and poison messages?Mid
رتّب لكل entity لو مطلوب، واستخدم version لكشف gap أو تحديث قديم. رسالة validation غلط ماتدخلش retry للأبد؛ اعزلها مع السبب وخطة replay.
I first identify which operations actually require ordering, usually changes for the same order rather than every message globally. I use an entity key and version to detect stale updates or gaps, and define whether a failure blocks later changes for that entity. Transient failures get bounded retries; invalid payloads or mapping failures are quarantined with diagnostics and an owner. After fixing the cause, replay uses the original identifiers so recovery does not create duplicate business effects.
اختبر نفسك
إجابات الاختبار وعلامات إكمال المحاور بتتحفظ على المتصفح ده، ومش بتتنقل لأجهزة تانية.
What does WSDL primarily describe?
Which statement about .NET 10 and WCF is correct?
A payment request times out. What do you know?
What belongs inside an anti-corruption layer?
An outbox dispatcher crashes after sending but before marking success. What is likely?
Which library target can bridge suitable Framework and .NET 10 code?
What is a characterization test's immediate purpose?
What indicates a CSV file is ready for import?
What must be considered before routing a migrated feature back to the old app?
What does streaming CSV processing guarantee by itself?